Skip to content

Commit fa07fda

Browse files
committed
Create contributing guide
Add a CONTRIBUTING.md guide explaining how to build, test, setup a development environment and release the library. Also mention the contributing guide in the README.md and add a RELEASE_NOTES template, so when releasing new versions is easy to clear the release notes by just copying the template. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 4e24e9d commit fa07fda

File tree

3 files changed

+105
-36
lines changed

3 files changed

+105
-36
lines changed

.github/RELEASE_NOTES.template.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Release Notes
2+
3+
## Summary
4+
5+
<!-- Here goes a general summary of what this release is about -->
6+
7+
## Upgrading
8+
9+
<!-- Here goes notes on how to upgrade from previous versions, including if there are any depractions and what they should be replaced with -->
10+
11+
## New Features
12+
13+
<!-- Here goes the main new features and examples or instructions on how to use them -->
14+
15+
## Bug Fixes
16+
17+
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->

CONTRIBUTING.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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!

README.md

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,13 @@
22

33
A development kit to interact with the Frequenz development platform.
44

5-
## Testing locally
6-
7-
### Prerequisites
8-
9-
#### Python version
5+
## Supported Python versions
106

117
* For x86_64 Python 3.8 - 3.10 are supported (tested).
128
* For arm64 only Python 3.8 is supported (due to some dependencies that only support 3.8).
139

14-
#### Development setup
15-
16-
You need to install the following development dependencies to be able to get
17-
and build all dependencies:
18-
19-
```sh
20-
python -m pip install grpcio-tools mypy-protobuf nox wheel
21-
```
22-
23-
### Running the whole test suite
24-
25-
Run the following command to run tests:
26-
27-
```sh
28-
nox
29-
```
30-
31-
You can also use `nox -R` to reuse the current testing environment to speed up
32-
test at the expense of a higher chance to end up with a dirty test environment.
33-
34-
### Running tests individually
35-
36-
For a better development test cycle you can install the runtime and test
37-
dependencies and run `pytest` manually.
38-
39-
```sh
40-
python -m pip install .
41-
python -m pip install pytest pytest-asyncio
10+
## Contributing
4211

43-
# And for example
44-
pytest tests/test_sdk.py
45-
```
12+
If you want to know how to build this project and contribute to it, please
13+
check out the [Contributing
14+
Guide](https://github.com/frequenz-floss/frequenz-sdk-python/CONTRIBUTING.md).

0 commit comments

Comments
 (0)