From de3cd224b1d6020cb33822e4455914a80111d964 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Tue, 3 Oct 2023 22:02:47 +0200 Subject: [PATCH 01/14] chore: add support for Python 3.12 --- .github/workflows/lint-and-test.yml | 3 ++- pyproject.toml | 3 ++- tox.ini | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 41e1f9e..eec78b5 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -19,8 +19,9 @@ jobs: - '3.9' - '3.10' - '3.11' - - 'pypy-3.8' + - '3.12' - 'pypy-3.9' + - 'pypy-3.10' steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml index eed9214..0884c6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: User Interfaces", @@ -75,7 +76,7 @@ multi_line_output = 3 profile = "black" [tool.black] -target-version = ["py38", "py39", "py310", "py311"] +target-version = ["py38", "py39", "py310", "py311", "py312"] [tool.bandit] exclude_dirs = ["tests"] diff --git a/tox.ini b/tox.ini index 76b26cb..fd8ec86 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ envlist = py39 py310 py311 + py312 pypy3 as-module lint @@ -18,7 +19,9 @@ python = 3.9: py39 3.10: py310 3.11: py311,lint,as-module + 3.12: py312 pypy-3.9: pypy3 + pypy-3.10: pypy3 [testenv] description = run unit tests From ff0b46a1c7e9411379a3e270765678e1b596b88a Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Tue, 3 Oct 2023 22:07:47 +0200 Subject: [PATCH 02/14] ci: enable lint&test for release-targeting PRs --- .github/workflows/lint-and-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index eec78b5..1b129a2 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -7,6 +7,7 @@ on: # yamllint disable-line rule:truthy pull_request: branches: - master + - 'release/**' jobs: tox: From 9e928a0a622b3fe05ad94484680fc7a9631e447d Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Wed, 4 Oct 2023 20:34:07 +0200 Subject: [PATCH 03/14] ci: fix Black version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2505027..4910811 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: name: isort - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.9.1 hooks: - id: black language_version: python3 From 2b5b7b22d4809cad4cb7443bf041117096c95a79 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Wed, 4 Oct 2023 20:37:14 +0200 Subject: [PATCH 04/14] style: apply updated Black rules --- src/argh/dispatching.py | 1 - tests/test_dispatching.py | 1 - 2 files changed, 2 deletions(-) diff --git a/src/argh/dispatching.py b/src/argh/dispatching.py index 8985efb..c1d8bb1 100644 --- a/src/argh/dispatching.py +++ b/src/argh/dispatching.py @@ -325,7 +325,6 @@ def default_exception_processor(exc: Exception) -> str: for line in result: yield line except tuple(wrappable_exceptions) as exc: - processor = getattr( function, ATTR_WRAPPED_EXCEPTIONS_PROCESSOR, default_exception_processor ) diff --git a/tests/test_dispatching.py b/tests/test_dispatching.py index 0c03549..a629cc2 100644 --- a/tests/test_dispatching.py +++ b/tests/test_dispatching.py @@ -72,7 +72,6 @@ def func(): @patch("argh.dispatching.add_commands") @patch("argparse.ArgumentParser") def test_entrypoint(ap_cls_mock, add_commands_mock, dispatch_mock): - entrypoint = argh.EntryPoint("my cool app") # no commands From e05e7eee6ace5411e98b681d509dc2254b0517f4 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Wed, 4 Oct 2023 20:57:36 +0200 Subject: [PATCH 05/14] chore: update pre-commit hook versions --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4910811..7cf4098 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: language_version: python3 - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 @@ -37,14 +37,14 @@ repos: - id: mypy - repo: https://github.com/PyCQA/bandit - rev: 1.7.4 + rev: 1.7.5 hooks: - id: bandit args: ["-c", "pyproject.toml"] additional_dependencies: ["bandit[toml]"] - repo: https://github.com/adrienverge/yamllint.git - rev: v1.29.0 + rev: v1.32.0 hooks: - id: yamllint files: \.(yaml|yml)$ From ccaaabb0f78146f95def951ca55f45f907f152aa Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 00:16:22 +0200 Subject: [PATCH 06/14] ci: debug --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index fd8ec86..e846c6b 100644 --- a/tox.ini +++ b/tox.ini @@ -50,3 +50,5 @@ description = verify with linters extras = linters commands = pre-commit run -a + git status + git diff From 7701beef9fb19f40da6d69aa6ddfe5578f84350c Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 00:25:07 +0200 Subject: [PATCH 07/14] ci: fix --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index e846c6b..de87805 100644 --- a/tox.ini +++ b/tox.ini @@ -48,6 +48,7 @@ commands = [testenv:lint] description = verify with linters extras = linters +allowlist_externals = git commands = pre-commit run -a git status From 33f620cfe1d710465371f16bba98128b15ca8d58 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 00:34:00 +0200 Subject: [PATCH 08/14] ci: debug --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0884c6b..d9ca502 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,9 +54,9 @@ completion = [ "argcomplete >= 2.0", ] test = [ - "tox >= 4.4", - "pytest >= 7.2", - "pytest-cov >= 4.0", + "tox >= 4.11.3", + "pytest >= 7.4", + "pytest-cov >= 4.1", ] docs = [ "sphinx >= 6.1", @@ -65,7 +65,7 @@ docs = [ "readthedocs-sphinx-search == 0.2.0", ] linters = [ - "pre-commit >= 3.0.4", + "pre-commit >= 3.4.0", ] [tool.distutils.bdist_wheel] @@ -76,7 +76,7 @@ multi_line_output = 3 profile = "black" [tool.black] -target-version = ["py38", "py39", "py310", "py311", "py312"] +target-version = ["py38", "py39", "py310", "py311"] # , "py312"] [tool.bandit] exclude_dirs = ["tests"] From 8f0d0917f662610eca9752e0220c406aa4c885a4 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 00:40:44 +0200 Subject: [PATCH 09/14] ci: debug --- tox.ini | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tox.ini b/tox.ini index de87805..76b26cb 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,6 @@ envlist = py39 py310 py311 - py312 pypy3 as-module lint @@ -19,9 +18,7 @@ python = 3.9: py39 3.10: py310 3.11: py311,lint,as-module - 3.12: py312 pypy-3.9: pypy3 - pypy-3.10: pypy3 [testenv] description = run unit tests @@ -48,8 +45,5 @@ commands = [testenv:lint] description = verify with linters extras = linters -allowlist_externals = git commands = pre-commit run -a - git status - git diff From 972f66250d4c1aa878e1dcf6334c707dafcdb19c Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 00:52:00 +0200 Subject: [PATCH 10/14] ci: un-debug :) --- .github/workflows/lint-and-test.yml | 2 +- pyproject.toml | 2 +- tox.ini | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 1b129a2..2c2515f 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -24,7 +24,7 @@ jobs: - 'pypy-3.9' - 'pypy-3.10' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/pyproject.toml b/pyproject.toml index d9ca502..9c5efc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ multi_line_output = 3 profile = "black" [tool.black] -target-version = ["py38", "py39", "py310", "py311"] # , "py312"] +target-version = ["py38", "py39", "py310", "py311", "py312"] [tool.bandit] exclude_dirs = ["tests"] diff --git a/tox.ini b/tox.ini index 76b26cb..16a182a 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ envlist = py39 py310 py311 + py312 pypy3 as-module lint @@ -18,7 +19,9 @@ python = 3.9: py39 3.10: py310 3.11: py311,lint,as-module + 3.12: py312 pypy-3.9: pypy3 + pypy-3.10: pypy3 [testenv] description = run unit tests @@ -46,4 +49,4 @@ commands = description = verify with linters extras = linters commands = - pre-commit run -a + pre-commit run -a From 50742739db837c2819a61eb148c57e6b3dc2209f Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 00:58:47 +0200 Subject: [PATCH 11/14] ci: fix black --- src/argh/dispatching.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/argh/dispatching.py b/src/argh/dispatching.py index 297f58d..1a62f22 100644 --- a/src/argh/dispatching.py +++ b/src/argh/dispatching.py @@ -303,6 +303,7 @@ def _execute_command( All other exceptions propagate unless marked as wrappable by :func:`wrap_errors`. """ + # the function is nested to catch certain exceptions (see below) def _call(): # Actually call the function From 5265b4d2832e88f024f75efd113523c0d34d5ba9 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 01:03:28 +0200 Subject: [PATCH 12/14] docs: update changelog --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 16d12a6..1ebe593 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -41,6 +41,7 @@ Deprecated: Enhancements: +- Added support for Python 3.12. - Added type annotations to existing Argh code (#185 → #189). - The `dispatch()` function has been refactored, so in case you need finer control over the process, two new, more granular functions can be used: From 642dcef5e4bc15de8419e8a065313d8b699ad7bd Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 01:06:41 +0200 Subject: [PATCH 13/14] docs: minor tweak in a code example --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index cca9202..1640583 100644 --- a/README.rst +++ b/README.rst @@ -105,7 +105,7 @@ A very simple application with one command: import argh def main() -> str: - return 'Hello world' + return "Hello world" argh.dispatch_command(main) From 383e781e5616c9227bb3c397efc85d95c32915d5 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 5 Oct 2023 01:08:12 +0200 Subject: [PATCH 14/14] docs: mention Python 3.12 in the list --- docs/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index be34547..f4197a7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -4,7 +4,7 @@ Dependencies ------------ The `argh` library is supported (and tested unless otherwise specified) -on the following versions of Python: 3.8, 3.9, 3.10, 3.11. +on the following versions of Python: 3.8, 3.9, 3.10, 3.11, 3.12. If you need support for ancient Pythons, please use the following versions of Argh (the numeric puns were semi-intentional):