|
| 1 | +# Contributing to `frequenz-sdk` |
| 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 | +You can also use `nox` to run the tests and other checks: |
| 22 | + |
| 23 | +```sh |
| 24 | +python -m pip install nox |
| 25 | +nox |
| 26 | +``` |
| 27 | + |
| 28 | +You can also use `nox -R` to reuse the current testing environment to speed up |
| 29 | +test at the expense of a higher chance to end up with a dirty test environment. |
| 30 | + |
| 31 | +### Running tests individually |
| 32 | + |
| 33 | +For a better development test cycle you can install the runtime and test |
| 34 | +dependencies and run `pytest` manually. |
| 35 | + |
| 36 | +```sh |
| 37 | +python -m pip install . |
| 38 | +python -m pip install pytest pytest-asyncio |
| 39 | + |
| 40 | +# And for example |
| 41 | +pytest tests/test_sdk.py |
| 42 | +``` |
| 43 | + |
| 44 | +## Releasing |
| 45 | + |
| 46 | +These are the steps to create a new release: |
| 47 | + |
| 48 | +1. Get the latest head you want to create a release from. |
| 49 | + |
| 50 | +2. Update the `RELEASE_NOTES.md` file if it is not complete, up to date, and |
| 51 | + clean from template comments (`<!-- ... ->`) and empty sections. Submit |
| 52 | + a pull request if an update is needed, wait until it is merged, and update |
| 53 | + the latest head you want to create a release from to get the new merged pull |
| 54 | + request. |
| 55 | + |
| 56 | +3. Create a new signed tag using the release notes and |
| 57 | + a [semver](https://semver.org/) compatible version number with a `v` prefix, |
| 58 | + for example: |
| 59 | + |
| 60 | + ```sh |
| 61 | + git tag -s -F RELEASE_NOTES.md v0.0.1 |
| 62 | + ``` |
| 63 | + |
| 64 | +4. Push the new tag. |
| 65 | + |
| 66 | +5. A GitHub action will test the tag and if all goes well it will create |
| 67 | + a [GitHub |
| 68 | + Release](https://github.com/frequenz-floss/frequenz-sdk-python/releases), |
| 69 | + create a new |
| 70 | + [announcement](https://github.com/frequenz-floss/frequenz-sdk-python/discussions/categories/announcements) |
| 71 | + about the release, and upload a new package to |
| 72 | + [PyPI](https://pypi.org/project/frequenz-sdk/) automatically. |
| 73 | + |
| 74 | +6. Once this is done, reset the `RELEASE_NOTES.md` with the template: |
| 75 | + |
| 76 | + ```sh |
| 77 | + cp .github/RELEASE_NOTES.template.md RELEASE_NOTES.md |
| 78 | + ``` |
| 79 | + |
| 80 | + Commit the new release notes and create a PR (this step should be automated |
| 81 | + eventually too). |
| 82 | + |
| 83 | +7. Celebrate! |
0 commit comments