Skip to content

Commit fd05fe6

Browse files
committed
Update contributing guidelines from template
1 parent f3e206b commit fd05fe6

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

CONTRIBUTING.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,21 @@ To build all components and publish all artifacts from your local machine, execu
9999
act -b -s VERSION="<MAJOR.MINOR.PATCH>" -j release
100100
```
101101

102-
In case you also want to automatically create a valid Github release, you also need to provide a valid `GITHUB_TOKEN` as a secret (`-s GITHUB_TOKEN=<token>`).
102+
In case you also want to automatically create a valid Github release, you also need to provide a valid `GITHUB_TOKEN` as a secret (`-s GITHUB_TOKEN=<token>`). Please refer to the next section for information on how to finish and publish the release.
103+
104+
##### Via Github Actions
105+
106+
To trigger our release pipeline from Github UI, you can either close a milestone that has a valid version name (`vMAJOR.MINOR.PATCH`) or execute the release pipeline manually via the `workflow_dispatch` UI in the Action Tab (`Actions -> release-pipeline -> Run Workflow`). The release pipeline will automatically create a pull request for the new version as well as a draft release on Github.
107+
108+
After successful execution of the release pipeline, the following steps are required to finish the release:
109+
110+
1. Merge the release PR into `main`. Preferably via merge commit to keep the version tag in the `main` branch. We suggest to use the following message for the merge commit: `Finalize release for version <VERSION> (#<PR>)`.
111+
2. Adapt the changelog of the draft release on Github (in the release section). Mention all other changes that are not covered by pull requests.
112+
3. Publish the release.
113+
114+
##### Resolve an unsuccessful release
115+
116+
In case the release pipeline fails at any step, we suggest to fix the problem based on the release pipeline logs and create a new release with an incremented `patch` version. To clean up the unsuccessful release, make sure to delete the following artifacts (if they exist): the release branch, the release PR, the version tag, the draft release, and any release artifact that was already published (e.g. on DockerHub, NPM or PyPi).
103117

104118
##### Via Github Actions
105119

@@ -148,7 +162,9 @@ Commit messages should be as standardized as possible within the repository. A f
148162
- Import Sorting: [isort](https://github.com/PyCQA/isort)
149163
- Linting: [flake8](https://github.com/PyCQA/flake8)
150164
- Type Checking: [mypy](https://github.com/python/mypy)
151-
- Testing: [pytest](http://doc.pytest.org/) + [nox](https://github.com/theacodes/nox)
165+
- Testing: [pytest](http://doc.pytest.org/) + [pipenv](https://github.com/pypa/pipenv)
166+
- Logging: [logging](https://docs.python.org/3/library/logging.html)
167+
- Package Manager: [pip](https://github.com/pypa/pip)
152168
- Use type hints wherever possible: [Cheatsheet](https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html)
153169
- Minimum compatibility: Python 3.6
154170

@@ -163,17 +179,17 @@ Commit messages should be as standardized as possible within the repository. A f
163179
We use [black](https://github.com/ambv/black) for code formatting and [isort](https://github.com/PyCQA/isort) for import sorting. The following commands run `black` and `isort` on all Python files of the component (when executed in the component root):
164180

165181
```bash
166-
python -m isort --profile black src
167-
python -m black src
182+
isort --profile black src
183+
black src
168184
```
169185

170186
If you want to only check if the formatting and sorting is applied correctly to all files, execute:
171187

172188
```bash
173189
# formatting check:
174-
python -m black --check src
190+
black --check src
175191
# import sorting check:
176-
python -m isort --profile black --check-only src
192+
isort --profile black --check-only src
177193
```
178194

179195
You can also configure `black` and `isort` inside your code editor. For example, if you're using [Visual Studio Code](https://code.visualstudio.com/) with the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python), you can add the following to your `settings.json` for formatting and auto-format your files on save:
@@ -205,11 +221,11 @@ We use [flake8](https://github.com/PyCQA/flake8) for linting, [mypy](https://git
205221

206222
```bash
207223
# type checks
208-
python -m mypy src
224+
mypy src
209225
# linting
210-
python -m flake8 src
226+
flake8 src
211227
# docstring checks
212-
python -m pydocstyle src
228+
pydocstyle src
213229
```
214230

215231
You can also configure `flake8`, `mypy`, and `pydocstyle` inside your code editor. For example, if you're using [Visual Studio Code](https://code.visualstudio.com/) with the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python), you can add the following to your `settings.json` for linting and type checking:
@@ -234,12 +250,13 @@ You can also configure `flake8`, `mypy`, and `pydocstyle` inside your code edito
234250
We use the [pytest](http://doc.pytest.org/) framework for testing. For more info on this, see the [pytest documentation](http://docs.pytest.org/en/latest/contents.html). Tests for modules and classes live in their own directories of the same name inside the `tests` folder. To be discovered, all test files and test functions need to be prefixed with `test_`. To run the test suite, execute:
235251

236252
```bash
237-
# run test suite:
238-
python -m pytest .
253+
# Run full test suite:
254+
pytest
255+
# Exclude all slow tests
256+
pytest -m "not slow"
239257
```
240258

241-
When adding tests, make sure to use descriptive names, keep the code short and concise and only test for one behavior at a time. Try to `parametrize` test cases wherever possible and avoid unnecessary imports. Extensive tests that take a long time should be marked with `@pytest.mark.slow`.
242-
259+
When adding tests, make sure to use descriptive names, keep the code short and concise and only test for one behavior at a time. Try to avoid unnecessary imports and use `parametrize` test cases wherever possible. Parametrizing tests allows to test multiple inputs to a function and verify that they return the expected output. Use [fixtures](https://docs.pytest.org/en/stable/fixture.html) to share test setups with - optional - setup and tear-down routines. Fixtures can also be parameterized. Extensive tests that take a long time should be marked with `@pytest.mark.slow`.
243260
## Code of Conduct
244261

245262
All members of the project community must abide by the [Contributor Covenant, version 2.0](./.github/CODE_OF_CONDUCT.md). Only by respecting each other we can develop a productive, collaborative community. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer.

0 commit comments

Comments
 (0)