## [v1.0.0](https://git.duniter.org/clients/python/duniterpy/-/milestones/12) (21st August 2021)
**See below the main changes for the v1.0**
No changes since the rc1.
## [v1.0.0rc1](https://git.duniter.org/clients/python/duniterpy/-/milestones/12) (25th July 2021)
**See below the main changes for the v1.0**
### Fixes
- #152, #170, !159: Fix `ESUserEndpoint` regex
- Fix datapod domain name in `request_data_elasticsearch` example
### Development Environment
- #149, !161: Change workflow by changing from `master` and default `dev` branches to a single `main` branch
- Add changelog link to PyPI
### Documentation
- !160: Fix autodoc generation by running it into Poetry virtualenv
- !158: Allow to trigger the documentation job without having the release stage completed
...
...
@@ -47,11 +55,14 @@ TL;DR: The key changes are the `Documents` refactoring, the removal of the async
The inclusion of the examples into the package, and the introduction of `pre-commit` tool for development purposes.
### This release breaks backward compatibility!
From this version, only major releases might break backward compatibility.
For 1.x minor versions, only `DeprecationWarning` will occur.
### Features
#### Documents refactoring
Major refactoring have been done on `Document` and its sub-classes.
All documents are now internally using a `signature` attribute which is a string and no longer a list of strings, except for the `Transaction` document which can handle multi-signatures.
It is no longer possible to pass the `signature` as argument at instantiation since it doesn’t make sense in the document life cycle.
...
...
@@ -60,21 +71,31 @@ The document version and the currency arguments are now set optional and default
The methods to check the signature·s have been moved as specific methods into the documents classes.
- #95, !144: Remove `signatures` argument from all `__init__()`’s documents subclasses:
-`Document` constructor is `Document(version: int, currency: str)`
- All `Document` subclasses can be directly signed when the optional `signing_key` argument is passed
- #172 `version` argument is now optional and have a proper default value per document type
-`currency` argument is now optional and defaults to `G1_CURRENCY_CODENAME`
```
signing_key: SigningKey = None,
version: int = VERSION,
currency: str = G1_CURRENCY_CODENAME,
```
- Introduce `Identity.from_bma_lookup_response()` to simplify examples
- Refactor `Document.signatures``List` as `Document.signature``str`
-`VerifyingKey.verify_document()` has been removed in favour of `Document.check_signature(pubkey)`
- Set `time` argument optional in `SimpleTransaction`
- #173, !150, !156: Make Transaction easier with single and multi-sign:
-`Transaction(signing_keys: Optional[Union[SigningKey, List[SigningKey]]] = None)` allows single signature or multi-signatures when created
-`Transaction.sign()` and `multi_sign()` now append signature to allow different key owner to sign additionally the Tx doc
- Introduce `Transaction.check_signature()` and `check_signatures()`
...
...
@@ -82,6 +103,7 @@ The methods to check the signature·s have been moved as specific methods into t
- #178, !152: `Membership`: Make `membership_type` argument optional defaulting to `IN`
- #175, !155: Rename `timestamp` and `blockstamp` attributes and arguments depending on their content:
-`timestamp` for time in seconds
-`block_id` for `BlockID` type
-`BlockUID` has been renamed to `BlockID` and `BlockID.block_uid()` to `get_block_id()`
...
...
@@ -89,6 +111,7 @@ The methods to check the signature·s have been moved as specific methods into t
- #163, !137: `Revocation.from_signed_raw()` now stores the block ID into a `BlockID` object
#### Network
The asynchronous property has been dropped to improve DuniterPy accessibility to new comers.
Improvements have been made on the endpoints handling.
...
...
@@ -104,11 +127,13 @@ Improvements have been made on the endpoints handling.
- !138: Add `flags` and `path` attributes into `GVAEndpoint.eq()` and `hash()` computations
#### Key handling
- #150, !130: Introduce DUBP Mnemonic SigningKey feature with `SigningKey.from_dubp_mnemonic()`
- #161, !142: Add DUBP Mnemonic example
- #181, !154: `CRCPubkey` class moved from `documents` to `key` package
#### Others
- #160, !134: Include `examples` into the Python package:
- They can be run into Python shell
- Read new examples usage documentation in the [README.md](README.md#Examples)
...
...
@@ -116,6 +141,7 @@ Improvements have been made on the endpoints handling.
- !147: Update `websocket-client` and `attrs` to major releases
### Development Environment
`pre-commit` tool has been introduce to run our development tools as pre-commit hooks to check when committing a change.
`isort`, a tool that sorts the imports automatically, has been introduced.
...
...
@@ -127,15 +153,17 @@ Improvements have been made on the endpoints handling.
- !132: Add support `pylint` v2.8.0
#### CI/CD
- #166, !140: Fix MR based pipelines which do not trigger the tools jobs when there is a code change
- #169, !146: Fix with a token for `gitlab-ci-lint` hook, which was no longer working since GitLab CI lint API requires authentication
- #177: Run `pre-commit` into tools jobs
### Fixes
- #134, !141: Fix license header showed into the documentation by using `#` comments rather than docstrings
Create and push a feature or bugfix release out of the `main` branch.
Name this branch after the ticket number `###`.
Open a merge request out of this branch to the `main` branch:
```bash
main <− ###_feature_branch
```
## Pre-commit
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, `pylint` code linting, `pyupgrade` syntax upgrader, `mypy` typing, and `gitlab-ci` linting.
Install `pre-commit` from your distribution. In case it is an outdated version, install it from `pip`:
```bash
sudo apt install pre-commit
pip install--user pre-commit
```
To install the `git-hooks`, run:
```bash
duniterpy> pre-commit install
```
Then each time you commit changes, the hooks will perform checks.
To manually run one of the tool above, run (eg for `isort`):
```bash
duniterpy> pre-commit run --all-files isort
```
To run all checks on all files:
```bash
duniterpy> pre-commit run -a
```
### Authorization for GitLab CI linter hook
`pre-commit run -a (gitlab-ci-linter)` is failing due to authorization required for CI lint API accesses.
When running this command, just ignore this failed hook.
In case you want to commit a `.gitlab-ci.yml` edition, this hook will prevent the commit creation.
You can [skip the hooks](https://stackoverflow.com/a/7230886) with `git commit -m "msg" --no-verify`.
This is fine for occasional `.gitlab-ci.yml` editions. In case you would like to edit this file more often and have it checked, ask a maintainer to provide you with `GITLAB_PRIVATE_TOKEN` environment variable that can be set into a shell configuration.
With Bash, in `$HOME/.bashrc` add the following:
```bash
export GITLAB_PRIVATE_TOKEN=""
```
With Fish, in `$HOME/.config/fish/config.fish` add the following:
```fish
set -xg GITLAB_PRIVATE_TOKEN ""
```
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
We are using [`pytest` framework](https://docs.pytest.org/).
- Run all tests with:
```bash
duniterpy> poetry run pytest
```
- Run specific tests by specifying the path to a file:
```bash
duniterpy> poetry run pytest tests/helpers/test_ws2p.py
```
- You can even specify a test from the selected file:
```bash
````bash
duniterpy> poetry run pytest tests/helpers/test_ws2p.py::test_generate_ws2p_endpoint
### Update copyright year
...
...
@@ -90,8 +110,8 @@ To handle a release, you have to follow this workflow:
```bash
./release.sh 0.50.0
```
````
* 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`
* To release to PyPI, the pipeline based on the tag should be used by triggerring the manual job on the `main` branch
- 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`
- To release to PyPI, the pipeline based on the tag should be used by triggerring the manual job on the `main` branch