DuniterPy issueshttps://git.duniter.org/clients/python/duniterpy/-/issues2024-01-29T10:42:03+01:00https://git.duniter.org/clients/python/duniterpy/-/issues/210Set up release feature from gitlab-ci2024-01-29T10:42:03+01:00MoulSet up release feature from gitlab-ci- https://docs.gitlab.com/ee/ci/yaml/#release
- https://docs.gitlab.com/ee/user/project/releases/release_cicd_examples.html
```yaml
release_job:
stage: package
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- ...- https://docs.gitlab.com/ee/ci/yaml/#release
- https://docs.gitlab.com/ee/user/project/releases/release_cicd_examples.html
```yaml
release_job:
stage: package
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo "running release_job"
release:
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
```
- [ ] Fix current releases
- [ ] Add missing releases
- https://git.duniter.org/clients/python/duniterpy/-/releases1.3.0https://git.duniter.org/clients/python/duniterpy/-/issues/209Bump copyright to 20252023-12-09T13:59:13+01:00MoulBump copyright to 2025- [ ] In the license copyright headers, with `insert-license` hook help, See `CONTRIBUTING.md`
- [ ] Bump `docs/conf.py:copyright` to 2025
- [ ] Open ticket for 2026 and link it to this one- [ ] In the license copyright headers, with `insert-license` hook help, See `CONTRIBUTING.md`
- [ ] Bump `docs/conf.py:copyright` to 2025
- [ ] Open ticket for 2026 and link it to this one1.3.02024-12-10https://git.duniter.org/clients/python/duniterpy/-/issues/208Add support for Python v3.132023-11-20T14:27:29+01:00MoulAdd support for Python v3.13### Python pre-releases
- [ ] Set up v3.13 test job
- [ ] With `allow_failure: true`, to allow tests to fail
### Python stable release
- [ ] Remove `allow_failure: true`, now on the tests should pass
- [ ] Move coverage to v3.13 job
-...### Python pre-releases
- [ ] Set up v3.13 test job
- [ ] With `allow_failure: true`, to allow tests to fail
### Python stable release
- [ ] Remove `allow_failure: true`, now on the tests should pass
- [ ] Move coverage to v3.13 job
- [ ] Set default container used by jobs to v3.13
- [ ] Handle deprecation warning and breaking features
### Post
- [ ] Open follow-up v3.14 tickets
### References
- Expected to be release the [October 1st 2024](https://peps.python.org/pep-0719/).
- docker/python3/poetry#10+1.3.02024-10-01https://git.duniter.org/clients/python/duniterpy/-/issues/207Bump Sphinx to v7 and sphinx-rtd-theme to v22023-10-02T21:16:30+02:00MoulBump Sphinx to v7 and sphinx-rtd-theme to v21.3.0https://git.duniter.org/clients/python/duniterpy/-/issues/206ModuleNotFoundError: No module named 'libnacl.version'2023-08-14T17:13:26+02:00FredModuleNotFoundError: No module named 'libnacl.version'I found that error using duniterpy-1.1.0 ```pip3 install duniterpy```
```
./tools/key_create_dunikey.py coucou coucou
Traceback (most recent call last):
File "/home/pi/.zen/Astroport.ONE/./tools/key_create_dunikey.py", line 18, in <mo...I found that error using duniterpy-1.1.0 ```pip3 install duniterpy```
```
./tools/key_create_dunikey.py coucou coucou
Traceback (most recent call last):
File "/home/pi/.zen/Astroport.ONE/./tools/key_create_dunikey.py", line 18, in <module>
from duniterpy.key import SigningKey
File "/usr/local/lib/python3.9/dist-packages/duniterpy/__init__.py", line 22, in <module>
from . import api, documents, key
File "/usr/local/lib/python3.9/dist-packages/duniterpy/key/__init__.py", line 21, in <module>
from .ascii_armor import AsciiArmor
File "/usr/local/lib/python3.9/dist-packages/duniterpy/key/ascii_armor.py", line 20, in <module>
from libnacl.version import version as libnacl_version
ModuleNotFoundError: No module named 'libnacl.version'
```
is it a bug?1.1.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/205gitlab-ci-linter is broken since GitLab v162023-11-21T22:25:46+01:00Moulgitlab-ci-linter is broken since GitLab v16- [`POST ci/lint` API endpoint deprecated](https://docs.gitlab.com/ee/update/deprecations.html#post-cilint-api-endpoint-deprecated)
- https://gitlab.com/devopshq/gitlab-ci-linter/-/issues/4
Whether it get fixed, we find an alternative, ...- [`POST ci/lint` API endpoint deprecated](https://docs.gitlab.com/ee/update/deprecations.html#post-cilint-api-endpoint-deprecated)
- https://gitlab.com/devopshq/gitlab-ci-linter/-/issues/4
Whether it get fixed, we find an alternative, or we get rid of this tool.
Alternatives:
- https://pre-commit.com/hooks.html
- https://gitlab.com/smop/pre-commit-hooks
- https://github.com/FalcoSuessgott/lint-gitlab-ci1.2.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/204jsonchema bump to v4 (2020-12 draft) breaks bma.blockchain.difficulties2023-06-30T09:03:32+02:00Mouljsonchema bump to v4 (2020-12 draft) breaks bma.blockchain.difficulties### Problem
Since [`jsonschema` bump from v3 to v4](e56163667dc77f609b70cf6c15c5191377860733), at least `bma.blockchain.difficulties` throws [the error in this post](https://github.com/python-jsonschema/jsonschema/issues/852#issuecomment...### Problem
Since [`jsonschema` bump from v3 to v4](e56163667dc77f609b70cf6c15c5191377860733), at least `bma.blockchain.difficulties` throws [the error in this post](https://github.com/python-jsonschema/jsonschema/issues/852#issuecomment-933376870).
<details><summary>Error</summary>
```sh
>>> from duniterpy.api import bma
>>> from duniterpy.api.client import Client
>>> c = Client("BMAS g1.duniter.org 443")
>>> c(bma.blockchain.difficulties)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/work/u23a14/ML/duniterpy/duniterpy/api/client.py", line 442, in __call__
return _function(self, *args, **kwargs)
File "/work/u23a14/ML/duniterpy/duniterpy/api/bma/blockchain.py", line 330, in difficulties
return client.get(f"{MODULE}/difficulties", schema=DIFFICULTIES_SCHEMA)
File "/work/u23a14/ML/duniterpy/duniterpy/api/client.py", line 359, in get
return client.request_url(
File "/work/u23a14/ML/duniterpy/duniterpy/api/client.py", line 274, in request_url
parse_response(content, schema)
File "/work/u23a14/ML/duniterpy/duniterpy/api/client.py", line 89, in parse_response
jsonschema.validate(data, schema)
File "/home/u23a14/.cache/pypoetry/virtualenvs/duniterpy-3m7gpsy_-py3.10/lib/python3.10/site-packages/jsonschema/validators.py", line 1117, in validate
cls.check_schema(schema)
File "/home/u23a14/.cache/pypoetry/virtualenvs/duniterpy-3m7gpsy_-py3.10/lib/python3.10/site-packages/jsonschema/validators.py", line 231, in check_schema
raise exceptions.SchemaError.create_from(error)
jsonschema.exceptions.SchemaError: [{'type': 'object', 'properties': {'uid': {'type': 'string'}, 'level': {'type': 'number'}}, 'required': ['uid', 'level']}] is not of type 'object', 'boolean'
Failed validating 'type' in metaschema['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][1]['properties']['items']['$dynamicRef']['allOf'][0]:
{'$defs': {'anchorString': {'pattern': '^[A-Za-z_][-A-Za-z0-9._]*$',
'type': 'string'},
'uriReferenceString': {'format': 'uri-reference',
'type': 'string'},
'uriString': {'format': 'uri', 'type': 'string'}},
'$dynamicAnchor': 'meta',
'$id': 'https://json-schema.org/draft/2020-12/meta/core',
'$schema': 'https://json-schema.org/draft/2020-12/schema',
'$vocabulary': {'https://json-schema.org/draft/2020-12/vocab/core': True},
'properties': {'$anchor': {'$ref': '#/$defs/anchorString'},
'$comment': {'type': 'string'},
'$defs': {'additionalProperties': {'$dynamicRef': '#meta'},
'type': 'object'},
'$dynamicAnchor': {'$ref': '#/$defs/anchorString'},
'$dynamicRef': {'$ref': '#/$defs/uriReferenceString'},
'$id': {'$comment': 'Non-empty fragments not allowed.',
'$ref': '#/$defs/uriReferenceString',
'pattern': '^[^#]*#?$'},
'$ref': {'$ref': '#/$defs/uriReferenceString'},
'$schema': {'$ref': '#/$defs/uriString'},
'$vocabulary': {'additionalProperties': {'type': 'boolean'},
'propertyNames': {'$ref': '#/$defs/uriString'},
'type': 'object'}},
'title': 'Core vocabulary meta-schema',
'type': ['object', 'boolean']}
On schema['properties']['levels']['items']:
[{'properties': {'level': {'type': 'number'},
'uid': {'type': 'string'}},
'required': ['uid', 'level'],
'type': 'object'}]
```
</details>
### JSON Drafts
From what I understood, [v4 introduced `2020-12` and `2019-09` drafts](https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst#v400) and therefore [the last one supported becomes default](https://python-jsonschema.readthedocs.io/en/stable/validate/#the-basics).
These drafts are JSON specifications for `jsonschema` schemas.
### BMA
I quickly checked the other `bma` `GET` requests, and they seem to work. We don’t have (integration) tests checking that the `GET` requests are still working.
`bma.blockchain.difficulties` does not support `2020-12` draft, but supports previous ones.
This seems to be only affecting `bma.blockchain.DIFFICULTIES_SCHEMA` since it’s the only one declaring `"items": []` `items` with a list. I would fix this one by using `prefixItems` as stated in [this ticket](https://github.com/python-jsonschema/jsonschema/issues/852#issuecomment-933376870).
### Solutions
We have these choices:
- switch back to `jsonschema` v3.2.0, but, I would prefer the latter to keep the latest `jsonschema` version
- In `DIFFICULTIES_SCHEMA`:
- set `"$schema": jsonschema.Draft7Validator.META_SCHEMA["$id"],`
- remove the list `[]` wrapping, not sure if this is correct
- set `prefixItems`
### References
- https://json-schema.org/draft/2020-12/release-notes.html#changes-to-items-and-additionalitems
- https://python-jsonschema.readthedocs.io/en/stable/faq/#my-schema-specifies-format-validation-why-do-invalid-instances-seem-valid1.2.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/203Store authentication files only as user readable2023-09-23T09:28:38+02:00MoulStore authentication files only as user readableAs reported into silkaj#420, save v1 auth file as user readable `600` `rw-------` mode, not group and world readable.
I found two approaches:
## Using the `umask`
Set `077` umask (for `600` permissions) and restore previous one:
```py
...As reported into silkaj#420, save v1 auth file as user readable `600` `rw-------` mode, not group and world readable.
I found two approaches:
## Using the `umask`
Set `077` umask (for `600` permissions) and restore previous one:
```py
current_umask = os.umask(0o077)
with open(path, encoding="utf-8") as fh:
fh.write(seedhex)
os.umask(current_umask)
```
- Inspired from [`libnacl`](https://github.com/saltstack/libnacl/blob/872303050f49d1daf7471c862e9fce9dbf6e8134/libnacl/base.py#L67-L73) that we are [already using](https://git.duniter.org/clients/python/duniterpy/-/blob/02cb8758f365b3a6c86e67af6614a9b44dda45cb/duniterpy/key/signing_key.py#L144).
## Using an opener
```py
def opener_user_rw(path, flags):
return os.open(path, flags, 0o600)
with open(path, "w", encoding="utf-8", opener=self.opener_user_rw) as fh:
fh.write(seedhex)
```
- https://docs.python.org/3/library/functions.html#open
- https://stackoverflow.com/a/45368120
- https://github.com/python/cpython/issues/73400#issuecomment-10937369381.2.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/202Introduce pre-commit-hooks2023-06-12T20:34:50+02:00MoulIntroduce pre-commit-hooks### Hooks to be introduced
- [x] Introduce [`pre-commit-hooks`](https://github.com/pre-commit/pre-commit-hooks)
- [x] Introduce `mdformat`
### GitLab CI
- [x] Use `pre-commit run -a $hook`
- [x] Merge all minor pre-commit hooks into one...### Hooks to be introduced
- [x] Introduce [`pre-commit-hooks`](https://github.com/pre-commit/pre-commit-hooks)
- [x] Introduce `mdformat`
### GitLab CI
- [x] Use `pre-commit run -a $hook`
- [x] Merge all minor pre-commit hooks into one job1.2.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/201Support BMA changes2023-06-06T21:53:33+02:00MoulSupport BMA changes### Sources and transactions retrieval
- nodes/typescript/duniter!1420+:
- `/tx/sources/$pubkey`
- `/tx/sources/$pubkey/pending`
- `/tx/history/$pubkey/`: nodes/typescript/duniter!1425+
- [x] jsonschema: `HISTORY_SCHEMA` set `receivi...### Sources and transactions retrieval
- nodes/typescript/duniter!1420+:
- `/tx/sources/$pubkey`
- `/tx/sources/$pubkey/pending`
- `/tx/history/$pubkey/`: nodes/typescript/duniter!1425+
- [x] jsonschema: `HISTORY_SCHEMA` set `receiving` as non required since the field was removed (also removed from Duniter v1.9)
### Wot: Support to pass `?pubkey` query
- Defaulting `pubkey_query` to:
- `True` would be breaking change when passing a `uid`, but would allow to use the optimization by default
- `False` would not be a breaking change, but requires a change to get the optimization: I go for this option
- `/wot/requirements/$pubkey?pubkey`: nodes/typescript/duniter!1422+
- nodes/typescript/duniter!1423+:
- `/wot/certifiers-of/$pubkey?pubkey`
- `/wot/certified-by/$pubkey?pubkey`
### `node/summary` storage
In `/node/summary` new fields can be added to the jsonschema, but do not set them as mandatory since it would break the backward compatibility
- nodes/typescript/duniter!1424+1.2.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/200Define custom exceptions to support new Pylint v2.16 rule: broad-exception-ra...2023-07-04T20:35:30+02:00MoulDefine custom exceptions to support new Pylint v2.16 rule: broad-exception-raisedSince [Pylint v2.16](https://pylint.readthedocs.io/en/latest/whatsnew/2/2.16/index.html), following report is raised:
- `W0719: Raising too general exception: Exception (broad-exception-raised)`
- [x] Define more precise (sub-set) except...Since [Pylint v2.16](https://pylint.readthedocs.io/en/latest/whatsnew/2/2.16/index.html), following report is raised:
- `W0719: Raising too general exception: Exception (broad-exception-raised)`
- [x] Define more precise (sub-set) exceptions:
- `api.ws2p.requests`
- `key.signing_key`
- `documents`
```py
class XxxException(Exception):
"""Raised when xxxx"""
```
- [x] Bump Pylint to latest version (v2.17+, or v3 if released as stable)
- [x] Silkaj: Remove/fix `disable=broad-except` in `auth.py`1.2.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/199Drop Python v3.8 support2023-05-18T16:05:59+02:00MoulDrop Python v3.8 support### Date when Python project won’t support v3.8
- [Python 3.8 support will be dropped in October 14th of 2024](https://devguide.python.org/versions/) [[1](https://endoflife.date/python)]
- [Platform which still uses Py3.8](https://repolo...### Date when Python project won’t support v3.8
- [Python 3.8 support will be dropped in October 14th of 2024](https://devguide.python.org/versions/) [[1](https://endoflife.date/python)]
- [Platform which still uses Py3.8](https://repology.org/badge/vertical-allrepos/python.svg)
## Todos
### DuniterPy
- [ ] `pyproject.toml`: Bump minimum versions:
- [ ] `tools.poetry.dependency.python`
- [ ] `tools.ruff.target-version`
- [ ] Delete test job for v3.8 from `.gitlab-ci.yml`
- [ ] Update minimal version in documentation: `README.md` and `docs/index.rst`
### Container
- [ ] Delete v3.8 Docker image generation
---
- [ ] Create ticket for Py3.9Backlog2024-10-14https://git.duniter.org/clients/python/duniterpy/-/issues/198Introduce ruff pre-commit hook2023-07-04T20:11:32+02:00MoulIntroduce ruff pre-commit hook- [x] Get rid of `isort`, `pylint`, `pyupgrade` pyproject, pre-commit, gitlab-ci configurations
- [x] Introduce `ruff` pyproject, pre-commit, gitlab-ci configurations
- [ ] `Makefile`: replace `pylint` with `ruff` (to be honest, I don’t ...- [x] Get rid of `isort`, `pylint`, `pyupgrade` pyproject, pre-commit, gitlab-ci configurations
- [x] Introduce `ruff` pyproject, pre-commit, gitlab-ci configurations
- [ ] `Makefile`: replace `pylint` with `ruff` (to be honest, I don’t see the point of make rules for pre-commit hooks).
- [ ] Fix `ruff` reports
- [ ] Use `pathlib`
- [ ] #200+
- [ ] Update hooks used in `CONTRIBUTING.md` § pre-commit1.3.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/197Bump copyright to 20242023-12-11T18:09:20+01:00MoulBump copyright to 2024- [x] In the license copyright headers, with `insert-license` hook help, See `CONTRIBUTING.md`
- [x] Bump `docs/conf.py:copyright` to 2024
- [x] Open ticket for 2025 and link it to this one: #209- [x] In the license copyright headers, with `insert-license` hook help, See `CONTRIBUTING.md`
- [x] Bump `docs/conf.py:copyright` to 2024
- [x] Open ticket for 2025 and link it to this one: #2091.2.0MoulMoul2023-12-10https://git.duniter.org/clients/python/duniterpy/-/issues/196Add support for Python v3.122023-10-04T20:21:43+02:00MoulAdd support for Python v3.12Expected to be release the [2nd October 2023](https://peps.python.org/pep-0693/).
- [x] docker/python3/poetry#8+: Unstable image in the meantime: using `rc` with `gcc` and `libffi-dev` installed
- [x] Set up v3.12 test job
- [x] Set `...Expected to be release the [2nd October 2023](https://peps.python.org/pep-0693/).
- [x] docker/python3/poetry#8+: Unstable image in the meantime: using `rc` with `gcc` and `libffi-dev` installed
- [x] Set up v3.12 test job
- [x] Set `allow_failure = True`
- [x] docker/python3/poetry#8+: Use stable tag (without `rc`) Remove `gcc` and `libffi-dev` installations
- [x] Move coverage to v3.12 job
- [x] Set default container to v3.12 (would require `pre-commit` and `git` to be installed)
- [x] Handle deprecation warning and breaking features
- [x] Open follow-up v3.13 tickets: #208+1.2.0MoulMoul2023-10-02https://git.duniter.org/clients/python/duniterpy/-/issues/195Fix coverage integration into GitLab2023-06-04T13:21:49+02:00MoulFix coverage integration into GitLabThe tests coverage integration into GitLab is no longer working since [it support changed from GitLab v15.0](https://docs.gitlab.com/ee/ci/pipelines/settings.html#merge-request-test-coverage-results).
The regex is no longer configured i...The tests coverage integration into GitLab is no longer working since [it support changed from GitLab v15.0](https://docs.gitlab.com/ee/ci/pipelines/settings.html#merge-request-test-coverage-results).
The regex is no longer configured into the project settings but in `.gitlab-ci.yml`
### Acceptance criteria
- [x] Fix coverage percentage integration into GitLab using this [regex](https://forum.gitlab.com/t/python-coverage-always-unknown/47819/3)
- [x] [Integrate coverage report into GitLab](https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html#python-example)1.3.0https://git.duniter.org/clients/python/duniterpy/-/issues/194Add support for Python v3.112023-08-14T16:45:37+02:00MoulAdd support for Python v3.11Expected to be release the [24th October 2022](https://peps.python.org/pep-0664/).
- [x] docker/python3/poetry#6+
- [x] Set up v3.11 test job
- [x] Move coverage to v3.11 job
- [x] Set default container to v3.11
- [x] Handle deprecation...Expected to be release the [24th October 2022](https://peps.python.org/pep-0664/).
- [x] docker/python3/poetry#6+
- [x] Set up v3.11 test job
- [x] Move coverage to v3.11 job
- [x] Set default container to v3.11
- [x] Handle deprecation warning and breaking features: [`typing.re.Pattern`](https://docs.python.org/3/library/typing.html#typing.Pattern)
- [x] Open follow-up v3.12 ticket: #1961.2.0MoulMoul2022-10-24https://git.duniter.org/clients/python/duniterpy/-/issues/193Drop Python v3.7 support2023-05-22T20:46:29+02:00MoulDrop Python v3.7 support### Date when Python project won’t support v3.7
- [Python 3.7 support will be dropped in June 27th of 2023](https://devguide.python.org/versions/)
- [Platform which still uses Py3.7](https://repology.org/badge/vertical-allrepos/python.s...### Date when Python project won’t support v3.7
- [Python 3.7 support will be dropped in June 27th of 2023](https://devguide.python.org/versions/)
- [Platform which still uses Py3.7](https://repology.org/badge/vertical-allrepos/python.svg)
## Todos
### DuniterPy
- [x] Bump minimum version in `pyproject.toml`
- [x] Delete test job for v3.7 from `.gitlab-ci.yml`
- [x] Upgrade `pyupgrade` to `--py38-plus` argument in `pre-commit` hook
- [x] Update minimal version in documentation: `README.md` and `docs/index.rst`
### Container
- [x] Delete v3.7 Docker image generation: docker/python3/poetry#9+
---
- [x] Create ticket for Py3.8: #199+1.2.0MoulMoul2023-06-27https://git.duniter.org/clients/python/duniterpy/-/issues/192Bump copyright to 20232022-12-11T16:13:42+01:00MoulBump copyright to 2023- [x] In the license copyright headers, with `insert-license` hook help, See `CONTRIBUTING.md`
- [x] Bump `docs/conf.py:copyright` to 2023
- [x] Open ticket for 2024 and link it to this one- [x] In the license copyright headers, with `insert-license` hook help, See `CONTRIBUTING.md`
- [x] Bump `docs/conf.py:copyright` to 2023
- [x] Open ticket for 2024 and link it to this one1.2.0MoulMoul2022-12-10https://git.duniter.org/clients/python/duniterpy/-/issues/191Implement __name__ property for documents objects2022-01-24T19:32:28+01:00matograineImplement __name__ property for documents objectsHaving a property __name__ may be of some help in some situations.Having a property __name__ may be of some help in some situations.