|
| 1 | +# Contributing to {{cookiecutter.title}} |
| 2 | + |
| 3 | +## Build |
| 4 | + |
| 5 | +You can use `build` to simply build the source and binary distribution: |
| 6 | + |
| 7 | +```sh |
| 8 | +python -m pip install build |
| 9 | +python -m build |
| 10 | +``` |
| 11 | + |
| 12 | +## Local development |
| 13 | + |
| 14 | +You can use editable installs to develop the project locally (it will install |
| 15 | +all the dependencies too): |
| 16 | + |
| 17 | +```sh |
| 18 | +python -m pip install -e . |
| 19 | +``` |
| 20 | + |
| 21 | +Or you can install all development dependencies (`mypy`, `pylint`, `pytest`, |
| 22 | +etc.) in one go too: |
| 23 | +```sh |
| 24 | +python -m pip install -e .[dev] |
| 25 | +``` |
| 26 | + |
| 27 | +If you don't want to install all the dependencies, you can also use `nox` to |
| 28 | +run the tests and other checks creating its own virtual environments: |
| 29 | + |
| 30 | +```sh |
| 31 | +python -m pip install .[dev-noxfile] |
| 32 | +nox |
| 33 | +``` |
| 34 | + |
| 35 | +You can also use `nox -R` to reuse the current testing environment to speed up |
| 36 | +test at the expense of a higher chance to end up with a dirty test environment. |
| 37 | + |
| 38 | +### Running tests / checks individually |
| 39 | + |
| 40 | +For a better development test cycle you can install the runtime and test |
| 41 | +dependencies and run `pytest` manually. |
| 42 | + |
| 43 | +```sh |
| 44 | +python -m pip install .[dev-pytest] # included in .[dev] too |
| 45 | + |
| 46 | +# And for example |
| 47 | +pytest tests/test_*.py |
| 48 | +``` |
| 49 | + |
| 50 | +Or you can use `nox`: |
| 51 | + |
| 52 | +```sh |
| 53 | +nox -R -s pytest -- test/test_*.py |
| 54 | +``` |
| 55 | + |
| 56 | +The same appliest to `pylint` or `mypy` for example: |
| 57 | + |
| 58 | +```sh |
| 59 | +nox -R -s pylint -- test/test_*.py |
| 60 | +nox -R -s mypy -- test/test_*.py |
| 61 | +``` |
| 62 | + |
| 63 | +## Releasing |
| 64 | + |
| 65 | +These are the steps to create a new release: |
| 66 | + |
| 67 | +1. Get the latest head you want to create a release from. |
| 68 | + |
| 69 | +2. Update the `RELEASE_NOTES.md` file if it is not complete, up to date, and |
| 70 | + clean from template comments (`<!-- ... ->`) and empty sections. Submit |
| 71 | + a pull request if an update is needed, wait until it is merged, and update |
| 72 | + the latest head you want to create a release from to get the new merged pull |
| 73 | + request. |
| 74 | + |
| 75 | +3. Create a new signed tag using the release notes and |
| 76 | + a [semver](https://semver.org/) compatible version number with a `v` prefix, |
| 77 | + for example: |
| 78 | + |
| 79 | + ```sh |
| 80 | + git tag -s --cleanup=whitespace -F RELEASE_NOTES.md v0.0.1 |
| 81 | + ``` |
| 82 | + |
| 83 | +4. Push the new tag. |
| 84 | + |
| 85 | +5. A GitHub action will test the tag and if all goes well it will create |
| 86 | + a [GitHub |
| 87 | + Release](https://github.com/{{cookiecutter.github_org}}/{{cookiecutter.github_repo_name}}/releases), |
| 88 | + and upload a new package to |
| 89 | + [PyPI](https://pypi.org/project/{{cookiecutter.pypi_package_name}}/) |
| 90 | + automatically. |
| 91 | + |
| 92 | +6. Once this is done, reset the `RELEASE_NOTES.md` with the template: |
| 93 | + |
| 94 | + ```sh |
| 95 | + cp .github/RELEASE_NOTES.template.md RELEASE_NOTES.md |
| 96 | + ``` |
| 97 | + |
| 98 | + Commit the new release notes and create a PR (this step should be automated |
| 99 | + eventually too). |
| 100 | + |
| 101 | +7. Celebrate! |
0 commit comments