diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88afe276159624dc14a7251601ef714b7f7edaf3..feca6fefab63a919e904ccf1dc13d5462ad10c6f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Goals -Part of the Duniter project running the Äž1 currency, Silkaj project is aiming to create a generic tool to manage his account and wallets, and to monitor the currency. +Part of the Duniter project running the Äž1 currency, Silkaj project is aiming at creating a generic tool to manage the main account and wallets, to administrate and to monitor the currency. ## Install the development environment @@ -52,11 +52,11 @@ Please read their documentations on how to use them the best possible. - [Pendulum](https://pendulum.eustace.io/docs/) - [texttable](https://github.com/foutaise/texttable/#documentation) -## Pre-commit +## Pre-commit hooks We are using [`pre-commit`](https://pre-commit.com/) tool to perform checks on staged changes before committing. -We are using it for `black` formatting, `isort` imports sorting, `pyupgrade`, and `gitlab-ci` linting. -We will use it for `pylint` code linting, `mypy` typing in the future. +We are using it for `black` formatting, `mypy` static typing, `gitlab-ci` linting. +We are also using `ruff` which replaces `isort` imports sorting, `pylint` code linting, `autoflake`, and `pyupgrade` Install `pre-commit` from your distribution. In case it is an outdated version, install it from `pip`: @@ -73,10 +73,10 @@ To install the `git-hooks`, run: Then each time you commit changes, the hooks will perform checks. -To manually run one of the tool above, run (eg for `isort`): +To manually run one of the tool above, run (eg for `black`): ```bash -> pre-commit run --all-files isort +> pre-commit run --all-files black ``` To run all checks on all files: @@ -106,22 +106,12 @@ set -xg GITLAB_PRIVATE_TOKEN "" Check out duniterpy#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 silkaj/cli.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 `git add` Black changes in order to commit your changes. - ## Tests We are using [Pytest](https://pytest.org) as a tests framework. To know more about how Silkaj implement it read the [project test documentation](doc/test_and_coverage.md). +Tests are stored into `unit` and `integration` folders depending on their types, then using the same tree as the source code. + To run tests, within `silkaj` repository: ```bash @@ -133,24 +123,24 @@ poetry run pytest Specifiy the path of the test: ```bash -poetry run pytest tests/test_end_to_end.py +poetry run pytest tests/unit/test_network.py ``` -## Version update +## Version bump We are using the [Semantic Versioning](https://semver.org). -To create a release, we use following script which will update the version in different files, and will make a commit and a tag out of it. +To create a release, we use following script which will bump the version in different files, and will make a commit and a tag out of it. ```bash -./release.sh 0.8.1 +./release.sh 0.20.0 ``` Then, a `git push --tags` is necessary to publish the tag. Git could be configured to publish tags with a simple `push`. ### How to release a pre-release on PyPI -[Append `[{a|b|rc}N]` to the version, it will be automatically detected as pre-release by PyPI](https://pythonpackaging.info/07-Package-Release.html). i.e.: `v0.10.0rc0`. +[Append `[{a|b|rc}N]` to the version, it will be automatically detected as pre-release by PyPI](https://pythonpackaging.info/07-Package-Release.html). i.e.: `v0.20.0rc0`. - install a pre-release from PyPI: @@ -207,21 +197,23 @@ The `--extra-index-url` is used to retrieve dependencies packages from the offic ### Own built Docker images - https://git.duniter.org/docker/python3/poetry -- Python images based on Debian Buster +- Python images based on latest Debian - Poetry installed on top -- Black installed on v3.8 ### Jobs - Checks: - - Format + - pre-commit hooks - Build - Tests on supported Python versions: - Installation - Pytest on Python supported versions -- PyPI distribution - - test - - stable +- Package + - PyPI stable + - PyPI test + - Docker pip + - Docker poetry +- Coverage website deployment on GitLab Pages ### Äž1 monetary license update