Skip to content
Snippets Groups Projects

Clarify readme and contributing documentation (#105, #155)

Merged Moul requested to merge 105_155_doc into main
3 files
+ 73
93
Compare changes
  • Side-by-side
  • Inline

Files

+ 59
12
# Contribute guide
# Contribute guide
 
## Install development environment
 
 
- [Install Poetry](https://python-poetry.org/docs/#installation)
 
- Install DuniterPy runtime and dev (test) dependencies:
 
 
```bash
 
poetry install
 
```
 
## Development workflow
## Development workflow
Create and push a feature or bugfix release out of the `main` branch.
Create and push a feature or bugfix release out of the `main` branch.
@@ -63,18 +72,6 @@ set -xg GITLAB_PRIVATE_TOKEN ""
@@ -63,18 +72,6 @@ set -xg GITLAB_PRIVATE_TOKEN ""
Check out #169 for more details.
Check out #169 for more details.
### Black formatting
We are using [Black](https://github.com/psf/black) formatter tool.
Run Black on a Python file to format it:
```bash
poetry run black duniterpy/file.py
```
With `pre-commit`, Black is called on staged files, so the commit should fail in case black would make changes.
You will have to add Black changes in order to commit your changes.
## Tests
## Tests
We are using [`pytest` framework](https://docs.pytest.org/).
We are using [`pytest` framework](https://docs.pytest.org/).
@@ -102,6 +99,38 @@ duniterpy> poetry run pytest tests/helpers/test_ws2p.py::test_generate_ws2p_endp
@@ -102,6 +99,38 @@ duniterpy> poetry run pytest tests/helpers/test_ws2p.py::test_generate_ws2p_endp
Follow [this documentation](https://github.com/Lucas-C/pre-commit-hooks#removing-old-license-and-replacing-it-with-a-new-one)
Follow [this documentation](https://github.com/Lucas-C/pre-commit-hooks#removing-old-license-and-replacing-it-with-a-new-one)
Only difference is to update the year in `license_header.txt` rather than `LICENSE.txt`.
Only difference is to update the year in `license_header.txt` rather than `LICENSE.txt`.
 
## Manual packaging and deployment to PyPI test and PyPI repositories
 
 
Change and commit and tag the new version number (semantic version number)
 
 
```bash
 
./release.sh 1.2.0
 
```
 
 
Build the PyPI package in the `dist` folder
 
 
```bash
 
make build
 
```
 
 
Deploy the package to PyPI test repository:
 
 
```bash
 
make deploy_test
 
```
 
 
Install DuniterPy from PyPI test repository and its dependencies from PyPI:
 
 
```bash
 
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.python.org/simple/ duniterpy
 
```
 
 
Deploy the package on PyPI repository:
 
 
```bash
 
make deploy
 
```
 
## Release workflow
## Release workflow
To handle a release, you have to follow this workflow:
To handle a release, you have to follow this workflow:
@@ -118,3 +147,21 @@ To handle a release, you have to follow this workflow:
@@ -118,3 +147,21 @@ To handle a release, you have to follow this workflow:
- Create a MR containing the changelog and the commit updating the version
- Create a MR containing the changelog and the commit updating the version
- Once the MR is merged to `main`, push the tag with `git push --tags`
- Once the MR is merged to `main`, push the tag with `git push --tags`
- To release to PyPI, the pipeline based on the tag should be used by triggerring the manual job on the `main` branch
- To release to PyPI, the pipeline based on the tag should be used by triggerring the manual job on the `main` branch
 
 
### How to generate and read locally the autodoc
 
 
- Install Sphinx, included into the `doc` dependencies group:
 
 
```bash
 
poetry install --with doc
 
```
 
 
- Generate HTML documentation in `public` directory:
 
 
```bash
 
make docs
 
```
 
 
## Docstrings
 
 
- When writing docstrings, use the reStructuredText format recommended by https://www.python.org/dev/peps/pep-0287/#docstring-significant-features
Loading