From 6e1c101b300b4c90b4fb10cd022fc8123cd93d92 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:41:37 +0000 Subject: [PATCH 1/3] chore: update dependencies - update requests, flatten-dict and test tooling to their latest versions - drop transitive packages from install_requires - require python 3.11+ and test against 3.11 to 3.14 - remove deprecated pytest-runner and setup.py test alias - update github actions and readme setup steps --- .github/workflows/test.yml | 6 ++--- README.md | 10 ++----- requirements.txt | 54 ++++++++++++++++++-------------------- setup.cfg | 3 --- setup.py | 46 +++++++++----------------------- 5 files changed, 42 insertions(+), 77 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 67ef43c..ede7710 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,12 +14,12 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ["3.7", "3.8", "3.9"] + python-version: ["3.11", "3.12", "3.13", "3.14"] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v7 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - name: install dependencies diff --git a/README.md b/README.md index 227ab5e..302c064 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ If you have any questions, requests or ideas open an issue or ask us in #python ### Prerequisites -- Python >= 3.7 +- Python >= 3.11 ### Setup @@ -75,19 +75,13 @@ pip install -r requirements.txt Run the following command to install the package in development mode: ```bash -python setup.py develop +pip install -e . ``` 6. Run the tests Use pytest to run the tests and ensure everything is working correctly: -```bash -python setup.py test -``` - -Or directly with pytest: - ```bash pytest ``` diff --git a/requirements.txt b/requirements.txt index d67a146..3cd220e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,30 +1,26 @@ -atomicwrites==1.4.1 -attrs==23.2.0 backoff==2.2.1 -certifi==2024.6.2 -chardet==3.0.4 -coverage==7.2.7 -flake8==3.5.0 -flake8-import-order==0.17.1 -flake8-print==3.1.0 -flake8-quotes==1.0.0 -flatten-dict==0.3.0 -idna==2.7 -importlib-metadata==6.7.0 -mccabe==0.6.1 -more-itertools==9.1.0 -pathlib2==2.3.7.post1 -pluggy==0.6.0 -py==1.11.0 -pycodestyle==2.3.1 -pyflakes==1.6.0 -pytest==3.6.1 -pytest-cov==2.5.1 -pytest-mock==1.10.0 -pytest-responses==0.3.0 -requests==2.19.1 -responses==0.10.15 -six==1.16.0 -typing_extensions==4.7.1 -urllib3==1.23 -zipp==3.15.0 +certifi==2026.11.20 +charset-normalizer==3.5.3 +coverage==7.18.0 +flake8==7.5.0 +flake8-import-order==0.19.2 +flake8-print==5.0.0 +flake8-quotes==3.4.0 +flatten-dict==0.6.0 +idna==3.20 +iniconfig==2.3.1 +mccabe==0.7.0 +packaging==26.4 +pluggy==1.7.0 +pycodestyle==2.15.0 +pyflakes==4.1.0 +pygments==2.21.0 +pytest==9.2.0 +pytest-cov==7.1.0 +pytest-mock==3.17.0 +pytest-responses==0.6.0 +pyyaml==6.0.4 +requests==2.34.2 +responses==0.26.3 +setuptools==84.2.1 +urllib3==2.8.0 diff --git a/setup.cfg b/setup.cfg index 36dfa98..dded69d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[aliases] -test=pytest - [flake8] max-line-length = 100 application-import-names = client diff --git a/setup.py b/setup.py index f42b820..0f2c100 100644 --- a/setup.py +++ b/setup.py @@ -1,40 +1,21 @@ -import sys - import setuptools requires = [ - 'atomicwrites==1.4.1', - 'attrs==23.2.0', 'backoff==2.2.1', - 'certifi==2024.6.2', - 'chardet==3.0.4', - 'flatten_dict==0.3.0', - 'idna==2.7', - 'importlib-metadata==6.7.0', - 'mccabe==0.6.1', - 'more-itertools==9.1.0', - 'pluggy==0.6.0', - 'py==1.11.0', - 'requests==2.19.1', - 'responses==0.10.15', - 'six==1.16.0', - 'typing_extensions==4.7.1', - 'urllib3==1.23', - 'zipp==3.15.0' + 'flatten-dict==0.6.0', + 'requests==2.34.2', ] tests_require = [ - 'coverage==7.2.7', - 'flake8==3.5.0', - 'flake8-import-order==0.17.1', - 'flake8-print==3.1.0', - 'flake8-quotes==1.0.0', - 'pycodestyle<2.4.0,>=2.0.0', - 'pyflakes==1.6.0', - 'pytest==3.6.1', - 'pytest-cov==2.5.1', - 'pytest-mock==1.10.0', - 'pytest-responses==0.3.0' + 'flake8==7.5.0', + 'flake8-import-order==0.19.2', + 'flake8-print==5.0.0', + 'flake8-quotes==3.4.0', + 'pytest==9.2.0', + 'pytest-cov==7.1.0', + 'pytest-mock==3.17.0', + 'pytest-responses==0.6.0', + 'responses==0.26.3', ] extras_require = { @@ -42,8 +23,6 @@ 'dev': requires + tests_require } -setup_requires = ['pytest-runner'] if {'pytest', 'test', 'ptr'}.intersection(sys.argv) else [] - setuptools.setup( name='arkecosystem-client', description='A simple Python API client for the ARK Blockchain.', @@ -52,8 +31,7 @@ author_email='info@client.io', url='https://github.com/ArkEcosystem/python-client', packages=setuptools.find_packages(exclude=['tests', 'tests.*']), + python_requires='>=3.11', install_requires=requires, extras_require=extras_require, - tests_require=tests_require, - setup_requires=setup_requires, ) From e253b0b5cfea26907dab8b2387c9ccc91da5305f Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Tue, 1 Dec 2026 15:25:03 +0000 Subject: [PATCH 2/3] style: fix lint errors --- client/client.py | 2 +- client/connection.py | 3 ++- client/resource.py | 1 + tests/api/test_blocks.py | 4 +--- tests/api/test_delegates.py | 4 +--- tests/api/test_locks.py | 4 +--- tests/api/test_node.py | 1 + tests/api/test_rounds.py | 2 -- tests/api/test_transactions.py | 8 +++++--- tests/api/test_wallets.py | 10 +++++----- tests/test_client.py | 2 -- tests/test_connection.py | 3 ++- tests/test_resource.py | 1 - 13 files changed, 20 insertions(+), 25 deletions(-) diff --git a/client/client.py b/client/client.py index b1120b8..a9039a7 100644 --- a/client/client.py +++ b/client/client.py @@ -4,9 +4,9 @@ from pathlib import Path from client.connection import Connection -from client.exceptions import ArkParameterException from client.resource import Resource + class ArkClient(object): def __init__(self, hostname): diff --git a/client/connection.py b/client/connection.py index 864a0e4..ee1e43d 100644 --- a/client/connection.py +++ b/client/connection.py @@ -1,8 +1,9 @@ import backoff + import requests -from client.exceptions import ArkHTTPException, ArkParameterException +from client.exceptions import ArkHTTPException def giveup_handler(_): diff --git a/client/resource.py b/client/resource.py index 34fa136..5b58fe7 100644 --- a/client/resource.py +++ b/client/resource.py @@ -1,5 +1,6 @@ from flatten_dict import flatten + class Resource(object): def __init__(self, connection): diff --git a/tests/api/test_blocks.py b/tests/api/test_blocks.py index 4ff7df0..de4555e 100644 --- a/tests/api/test_blocks.py +++ b/tests/api/test_blocks.py @@ -1,5 +1,3 @@ -import json - import responses from client import ArkClient @@ -44,7 +42,7 @@ def test_all_calls_correct_url_with_additional_params(): ) client = ArkClient('http://127.0.0.1:4002') - client.blocks.all(page=5, limit=69, orderBy="timestamp.epoch", height=6838329) + client.blocks.all(page=5, limit=69, orderBy='timestamp.epoch', height=6838329) assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/blocks?') assert 'page=5' in responses.calls[0].request.url diff --git a/tests/api/test_delegates.py b/tests/api/test_delegates.py index 5ac2091..0ea092c 100644 --- a/tests/api/test_delegates.py +++ b/tests/api/test_delegates.py @@ -1,5 +1,3 @@ -import json - import responses from client import ArkClient @@ -44,7 +42,7 @@ def test_all_calls_correct_url_with_additional_params(): ) client = ArkClient('http://127.0.0.1:4002') - client.delegates.all(page=5, limit=69, orderBy="username") + client.delegates.all(page=5, limit=69, orderBy='username') assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/delegates?') assert 'page=5' in responses.calls[0].request.url diff --git a/tests/api/test_locks.py b/tests/api/test_locks.py index 798dfb1..2a1f0b2 100644 --- a/tests/api/test_locks.py +++ b/tests/api/test_locks.py @@ -1,5 +1,3 @@ -import json - import responses from client import ArkClient @@ -44,7 +42,7 @@ def test_all_calls_correct_url_with_additional_params(): ) client = ArkClient('http://127.0.0.1:4002') - client.locks.all(page=5, limit=69, orderBy="id") + client.locks.all(page=5, limit=69, orderBy='id') assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/locks?') assert 'page=5' in responses.calls[0].request.url diff --git a/tests/api/test_node.py b/tests/api/test_node.py index e241b75..3fb9204 100644 --- a/tests/api/test_node.py +++ b/tests/api/test_node.py @@ -58,6 +58,7 @@ def test_configuration_crypto_call_correct_url(): assert len(responses.calls) == 1 assert responses.calls[0].request.url == 'http://127.0.0.1:4002/node/configuration/crypto' + def test_fees_calls_correct_url(): responses.add( responses.GET, diff --git a/tests/api/test_rounds.py b/tests/api/test_rounds.py index 7a156be..4a357ee 100644 --- a/tests/api/test_rounds.py +++ b/tests/api/test_rounds.py @@ -1,5 +1,3 @@ -import json - import responses from client import ArkClient diff --git a/tests/api/test_transactions.py b/tests/api/test_transactions.py index b39921a..3b727af 100644 --- a/tests/api/test_transactions.py +++ b/tests/api/test_transactions.py @@ -44,7 +44,7 @@ def test_all_calls_correct_url_with_additional_params(): ) client = ArkClient('http://127.0.0.1:4002') - client.transactions.all(page=5, limit=69, orderBy="timestamp.epoch") + client.transactions.all(page=5, limit=69, orderBy='timestamp.epoch') assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/transactions?') assert 'page=5' in responses.calls[0].request.url @@ -128,9 +128,11 @@ def test_all_unconfirmed_calls_correct_url_with_additional_params(): ) client = ArkClient('http://127.0.0.1:4002') - client.transactions.all_unconfirmed(page=5, limit=69, orderBy="timestamp.epoch") + client.transactions.all_unconfirmed(page=5, limit=69, orderBy='timestamp.epoch') assert len(responses.calls) == 1 - assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/transactions/unconfirmed?') + assert responses.calls[0].request.url.startswith( + 'http://127.0.0.1:4002/transactions/unconfirmed?' + ) assert 'page=5' in responses.calls[0].request.url assert 'limit=69' in responses.calls[0].request.url assert 'orderBy=timestamp.epoch' in responses.calls[0].request.url diff --git a/tests/api/test_wallets.py b/tests/api/test_wallets.py index 033a5f6..f98b31a 100644 --- a/tests/api/test_wallets.py +++ b/tests/api/test_wallets.py @@ -1,5 +1,3 @@ -import json - import responses from client import ArkClient @@ -108,7 +106,7 @@ def test_locks_calls_correct_url_with_additional_params(): ) client = ArkClient('http://127.0.0.1:4002') - client.wallets.locks(wallet_id=wallet_id, page=5, limit=69, orderBy="timestamp.epoch") + client.wallets.locks(wallet_id=wallet_id, page=5, limit=69, orderBy='timestamp.epoch') assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/wallets/12345/locks?') assert 'page=5' in responses.calls[0].request.url @@ -162,9 +160,11 @@ def test_transactions_calls_correct_url_with_additional_params(): ) client = ArkClient('http://127.0.0.1:4002') - client.wallets.transactions(wallet_id=wallet_id, page=5, limit=69, orderBy="timestamp.epoch") + client.wallets.transactions(wallet_id=wallet_id, page=5, limit=69, orderBy='timestamp.epoch') assert len(responses.calls) == 1 - assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/wallets/12345/transactions?') + assert responses.calls[0].request.url.startswith( + 'http://127.0.0.1:4002/wallets/12345/transactions?' + ) assert 'page=5' in responses.calls[0].request.url assert 'limit=69' in responses.calls[0].request.url assert 'orderBy=timestamp.epoch' in responses.calls[0].request.url diff --git a/tests/test_client.py b/tests/test_client.py index 33681b8..18b4592 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,5 +1,3 @@ -import pytest - from client.client import ArkClient from client.connection import Connection diff --git a/tests/test_connection.py b/tests/test_connection.py index 60bf571..9f5df06 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -14,6 +14,7 @@ def test_connection_creation_sets_default_session_headers_and_variables(): assert isinstance(connection.session, requests.Session) assert connection.session.headers['Content-Type'] == 'application/json' + def test_connection_request_retry_successful(): responses.add( responses.GET, @@ -46,7 +47,7 @@ def test_connection_raises_for_request_retry_failure(): connection = Connection('http://127.0.0.1:4003') - with pytest.raises(ArkHTTPException) as exception: + with pytest.raises(ArkHTTPException): connection.get('spongebob') assert len(responses.calls) == 3 diff --git a/tests/test_resource.py b/tests/test_resource.py index 8b22eec..264d933 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -20,4 +20,3 @@ def test_request_post_calls_connection_post_with_correct_params(mocker): resource.request_post('spongebob', data={'one': 'two'}, params={'foo': 'bar'}) post_mock.assert_called_once_with('spongebob', data={'one': 'two'}, params={'foo': 'bar'}) - From 26bcf428a1d16a9645b3060df159ad737877b472 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Tue, 1 Dec 2026 15:25:03 +0000 Subject: [PATCH 3/3] ci: add lint workflow --- .github/workflows/lint.yml | 29 +++++++++++++++++++++++++++++ setup.cfg | 1 + 2 files changed, 30 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..4d93d50 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,29 @@ +name: Lint + +on: + push: + branches: + - "master" + - "develop" + pull_request: + types: [ready_for_review, synchronize, opened] + +jobs: + flake8: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v7 + - name: Set up Python + uses: actions/setup-python@v7 + with: + python-version: "3.14" + - name: install dependencies + run: | + python3 -m venv venv + . venv/bin/activate + pip install .[test] + - name: run linter + run: | + . venv/bin/activate + make lint diff --git a/setup.cfg b/setup.cfg index dded69d..412908a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,7 @@ [flake8] max-line-length = 100 application-import-names = client +extend-exclude = .venv,venv,build,dist [tool:pytest] addopts = --verbose -s