Skip to content

Commit 4b768a8

Browse files
committed
Add API-specific sections to the CONTRIBUTING template
Because of the protocol buffers stuff, the API repos need a few more instructions on how to contribute. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 9ba467a commit 4b768a8

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

cookiecutter/{{cookiecutter.github_repo_name}}/CONTRIBUTING.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,38 @@ python -m build
1010
```
1111

1212
## Local development
13+
{%- if cookiecutter.type == "api" %}
14+
15+
You need to make sure you have the `git submodules` updated:
16+
17+
```sh
18+
git submodule update --init
19+
```
20+
21+
### Running protolint
22+
23+
To make sure some common mistakes are avoided and to ensure a consistent style
24+
it is recommended to run `protolint`. After you [installed
25+
`protolint`](https://github.com/yoheimuta/protolint#installation), just run:
26+
27+
```sh
28+
protolint lint proto
29+
```
30+
31+
### Python setup
32+
{%- endif %}
1333

1434
You can use editable installs to develop the project locally (it will install
1535
all the dependencies too):
1636

1737
```sh
1838
python -m pip install -e .
1939
```
40+
{%- if cookiecutter.type == "api" %}
41+
42+
This will also generate the Python files from the `proto/` files and leave them
43+
in `py/`, so you can inspect them.
44+
{%- endif %}
2045

2146
Or you can install all development dependencies (`mypy`, `pylint`, `pytest`,
2247
etc.) in one go too:
@@ -34,6 +59,31 @@ nox
3459

3560
You can also use `nox -R` to reuse the current testing environment to speed up
3661
test at the expense of a higher chance to end up with a dirty test environment.
62+
{%- if cookiecutter.type == "api" %}
63+
64+
### Upgrading dependencies
65+
66+
If you want to update the dependency `frequenz-api-common`, then you need to:
67+
68+
1. Update the submodule `frequenz-api-common`
69+
2. Update the version of the `frequenz-api-common` package in `pyproject.toml`
70+
71+
The version of `frequenz-api-common` used in both places mentioned above should
72+
be the same.
73+
74+
Here is an example of upgrading the `frequenz-api-common` dependency to version
75+
`v0.2.0`:
76+
```sh
77+
ver="0.2.0"
78+
79+
cd submodules/frequenz-api-common
80+
git remote update
81+
git checkout v${ver}
82+
cd -
83+
84+
sed s/"frequenz-api-common == [0-9]\.[0-9]\.[0-9]"/"frequenz-api-common == ${ver}"/g -i pyproject.toml
85+
```
86+
{%- endif %}
3787

3888
### Running tests / checks individually
3989

@@ -67,9 +117,9 @@ These are the steps to create a new release:
67117
1. Get the latest head you want to create a release from.
68118

69119
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
120+
remove template comments (`<!-- ... ->`) and empty sections. Submit a pull
121+
request if an update is needed, wait until it is merged, and update the
122+
latest head you want to create a release from to get the new merged pull
73123
request.
74124

75125
3. Create a new signed tag using the release notes and

0 commit comments

Comments
 (0)