diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 3921299..1ea274a 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -21,10 +21,11 @@ jobs: - '3.9' - '3.10' - '3.11' - - 'pypy-3.8' + - '3.12' - '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/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2505027..7cf4098 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,13 +21,13 @@ repos: name: isort - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.9.1 hooks: - id: black 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)$ 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: 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) 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): diff --git a/pyproject.toml b/pyproject.toml index eed9214..9c5efc7 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", @@ -53,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", @@ -64,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] @@ -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/src/argh/dispatching.py b/src/argh/dispatching.py index 1ad6a03..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 @@ -360,7 +361,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 f14ffc0..987b8c8 100644 --- a/tests/test_dispatching.py +++ b/tests/test_dispatching.py @@ -121,7 +121,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 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