diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 74c175a..1a8f0a1 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.7.0 +current_version = 0.8.0 commit = True tag = True diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index 4584924..0000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,9 +0,0 @@ -# This file is managed by 'repo_helper'. Don't edit it directly. ---- -version: 1 -update_configs: -- package_manager: python - directory: / - update_schedule: weekly - default_reviewers: - - domdfcoding diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e769ad3..454225a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,5 +6,6 @@ updates: directory: / schedule: interval: weekly + open-pull-requests-limit: 0 reviewers: - domdfcoding diff --git a/.github/workflows/conda_ci.yml b/.github/workflows/conda_ci.yml index 03f015d..c10fdf1 100644 --- a/.github/workflows/conda_ci.yml +++ b/.github/workflows/conda_ci.yml @@ -19,19 +19,20 @@ jobs: steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Setup Python 🐍 - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: - python-version: "3.8" + python-version: "3.11" - name: Setup Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v2.1.1 with: activate-environment: env - conda-build-version: 3.23.3 - python-version: "3.8" + conda-build-version: 3.28.4 + miniconda-version: py311_24.1.2-0 + python-version: "3.11" miniforge-variant: Mambaforge - name: Install dependencies 🔧 @@ -57,7 +58,7 @@ jobs: - name: "Install package" run: | - $CONDA/bin/conda install -c file://$(pwd)/conda-bld formate=0.7.0=py_1 -y || exit 1 + $CONDA/bin/conda install -c file://$(pwd)/conda-bld formate=0.8.0=py_1 -y || exit 1 - name: "Run Tests" run: | diff --git a/.github/workflows/docs_test_action.yml b/.github/workflows/docs_test_action.yml index b09bde3..8f60ba5 100644 --- a/.github/workflows/docs_test_action.yml +++ b/.github/workflows/docs_test_action.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Check for changed files uses: dorny/paths-filter@v2 diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 8221173..0a8c0c3 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Check for changed files uses: dorny/paths-filter@v2 @@ -33,7 +33,7 @@ jobs: - name: Setup Python 🐍 if: steps.changes.outputs.code == 'true' - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: python-version: "3.8" diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 9b28b5f..10c6f30 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -25,7 +25,7 @@ jobs: steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Check for changed files uses: dorny/paths-filter@v2 @@ -38,7 +38,7 @@ jobs: - name: Setup Python 🐍 if: steps.changes.outputs.code == 'true' - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: python-version: "3.8" diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 5366694..50fe594 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: "windows-2019" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13.0-rc.1,pypy-3.6,pypy-3.7,pypy-3.8,pypy-3.9' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.6,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False @@ -35,15 +35,15 @@ jobs: - {python-version: "3.10", testenvs: "py310-click{7,8.0,8.1},build", experimental: False} - {python-version: "3.11", testenvs: "py311-click{7,8.0,8.1},build", experimental: False} - {python-version: "3.12", testenvs: "py312-click{7,8.0,8.1},build", experimental: False} - - {python-version: "3.13.0-rc.1", testenvs: "py313-dev-click{7,8.0,8.1},build", experimental: True} + - {python-version: "3.13", testenvs: "py313-dev-click{7,8.0,8.1},build", experimental: True} - {python-version: "pypy-3.6", testenvs: "pypy36-click{7,8.0}", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37-click{7,8.0,8.1},build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38-click{7,8.0,8.1},build", experimental: False} - - {python-version: "pypy-3.9", testenvs: "pypy39-click{7,8.0,8.1},build", experimental: True} + - {python-version: "pypy-3.9-v7.3.15", testenvs: "pypy39-click{7,8.0,8.1},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Check for changed files if: startsWith(github.ref, 'refs/tags/') != true @@ -58,7 +58,7 @@ jobs: - name: Setup Python 🐍 id: setup-python if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: python-version: "${{ matrix.config.python-version }}" @@ -75,7 +75,7 @@ jobs: run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - name: "Upload Coverage 🚀" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index d1a35bd..9460074 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -23,7 +23,7 @@ jobs: runs-on: "ubuntu-20.04" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13.0-rc.1,pypy-3.6,pypy-3.7,pypy-3.8,pypy-3.9' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.6,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False @@ -36,7 +36,7 @@ jobs: - {python-version: "3.10", testenvs: "py310-click{7,8.0,8.1},build", experimental: False} - {python-version: "3.11", testenvs: "py311-click{7,8.0,8.1},build", experimental: False} - {python-version: "3.12", testenvs: "py312-click{7,8.0,8.1},build", experimental: False} - - {python-version: "3.13.0-rc.1", testenvs: "py313-dev-click{7,8.0,8.1},build", experimental: True} + - {python-version: "3.13", testenvs: "py313-dev-click{7,8.0,8.1},build", experimental: True} - {python-version: "pypy-3.6", testenvs: "pypy36-click{7,8.0},build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37-click{7,8.0,8.1},build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38-click{7,8.0,8.1},build", experimental: False} @@ -44,7 +44,7 @@ jobs: steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Check for changed files if: startsWith(github.ref, 'refs/tags/') != true @@ -59,7 +59,7 @@ jobs: - name: Setup Python 🐍 id: setup-python if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: python-version: "${{ matrix.config.python-version }}" @@ -77,7 +77,7 @@ jobs: run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - name: "Upload Coverage 🚀" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" @@ -89,10 +89,10 @@ jobs: runs-on: "ubuntu-20.04" steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Setup Python 🐍 - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: python-version: 3.8 @@ -102,7 +102,7 @@ jobs: python -m pip install --upgrade "coveralls>=3.0.0" coverage_pyver_pragma - name: "Download Coverage 🪂" - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: coverage @@ -120,7 +120,7 @@ jobs: - name: "Upload Combined Coverage Artefact 🚀" if: ${{ steps.show.outcome != 'failure' }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: "combined-coverage" path: .coverage @@ -138,11 +138,11 @@ jobs: runs-on: "ubuntu-20.04" steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" if: startsWith(github.ref, 'refs/tags/') - name: Setup Python 🐍 - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" if: startsWith(github.ref, 'refs/tags/') with: python-version: 3.8 @@ -183,19 +183,20 @@ jobs: if: startsWith(github.ref, 'refs/tags/') || (startsWith(github.event.head_commit.message, 'Bump version') != true) steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Setup Python 🐍 - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: - python-version: 3.8 + python-version: 3.11 - name: Setup Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v2.1.1 with: activate-environment: env - conda-build-version: 3.23.3 - python-version: "3.8" + conda-build-version: 3.28.4 + miniconda-version: py311_24.1.2-0 + python-version: "3.11" miniforge-variant: Mambaforge - name: Install dependencies 🔧 diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index 2141b62..046d1be 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -18,11 +18,11 @@ permissions: jobs: tests: - name: "macos-latest / Python ${{ matrix.config.python-version }}" - runs-on: "macos-latest" + name: "macos-13 / Python ${{ matrix.config.python-version }}" + runs-on: "macos-13" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13.0-rc.1,pypy-3.7,pypy-3.8,pypy-3.9' + USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False @@ -35,14 +35,14 @@ jobs: - {python-version: "3.10", testenvs: "py310-click{7,8.0,8.1},build", experimental: False} - {python-version: "3.11", testenvs: "py311-click{7,8.0,8.1},build", experimental: False} - {python-version: "3.12", testenvs: "py312-click{7,8.0,8.1},build", experimental: False} - - {python-version: "3.13.0-rc.1", testenvs: "py313-dev-click{7,8.0,8.1},build", experimental: True} + - {python-version: "3.13", testenvs: "py313-dev-click{7,8.0,8.1},build", experimental: True} - {python-version: "pypy-3.7", testenvs: "pypy37-click{7,8.0,8.1},build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38-click{7,8.0,8.1},build", experimental: False} - {python-version: "pypy-3.9", testenvs: "pypy39-click{7,8.0,8.1},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v3" + uses: "actions/checkout@v4" - name: Check for changed files if: startsWith(github.ref, 'refs/tags/') != true @@ -57,7 +57,7 @@ jobs: - name: Setup Python 🐍 id: setup-python if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} - uses: "actions/setup-python@v4" + uses: "actions/setup-python@v5" with: python-version: "${{ matrix.config.python-version }}" @@ -74,7 +74,7 @@ jobs: run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - name: "Upload Coverage 🚀" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" diff --git a/.github/workflows/safety.yml b/.github/workflows/safety.yml index f493900..1f50dae 100644 --- a/.github/workflows/safety.yml +++ b/.github/workflows/safety.yml @@ -34,7 +34,7 @@ jobs: if: steps.changes.outputs.code == 'true' uses: "actions/setup-python@v2" with: - python-version: "3.6" + python-version: "3.8" - name: Install dependencies 🔧 if: steps.changes.outputs.code == 'true' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32d1891..e7e870d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ ci: repos: - repo: https://github.com/repo-helper/pyproject-parser - rev: v0.9.0 + rev: v0.11.1 hooks: - id: reformat-pyproject @@ -42,14 +42,14 @@ repos: exclude: ^(doc-source/conf|__pkginfo__|setup|tests/.*)\.py$ - id: bind-requirements - - repo: https://github.com/domdfcoding/flake8-dunder-all - rev: v0.3.0 + - repo: https://github.com/python-formate/flake8-dunder-all + rev: v0.4.1 hooks: - id: ensure-dunder-all files: ^formate/.*\.py$ - repo: https://github.com/domdfcoding/flake2lint - rev: v0.4.2 + rev: v0.4.3 hooks: - id: flake2lint @@ -76,18 +76,18 @@ repos: - id: forbid-crlf - repo: https://github.com/python-formate/snippet-fmt - rev: v0.1.4 + rev: v0.1.5 hooks: - id: snippet-fmt - repo: https://github.com/python-formate/formate - rev: v0.5.0 + rev: v0.7.0 hooks: - id: formate exclude: ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$ - - repo: https://github.com/domdfcoding/dep_checker - rev: v0.7.1 + - repo: https://github.com/python-coincidence/dep_checker + rev: v0.8.0 hooks: - id: dep_checker args: diff --git a/.readthedocs.yml b/.readthedocs.yml index 4a2ec5f..e928b70 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -19,3 +19,6 @@ build: jobs: post_create_environment: - pip install . + post_install: + - pip install sphinxcontrib-applehelp==1.0.4 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.1 + sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 diff --git a/README.rst b/README.rst index 7c0e133..abc6692 100644 --- a/README.rst +++ b/README.rst @@ -111,7 +111,7 @@ See `the documentation`_ for more information. .. |language| image:: https://img.shields.io/github/languages/top/python-formate/formate :alt: GitHub top language -.. |commits-since| image:: https://img.shields.io/github/commits-since/python-formate/formate/v0.7.0 +.. |commits-since| image:: https://img.shields.io/github/commits-since/python-formate/formate/v0.8.0 :target: https://github.com/python-formate/formate/pulse :alt: GitHub commits since tagged version @@ -119,7 +119,7 @@ See `the documentation`_ for more information. :target: https://github.com/python-formate/formate/commit/master :alt: GitHub last commit -.. |maintained| image:: https://img.shields.io/maintenance/yes/2023 +.. |maintained| image:: https://img.shields.io/maintenance/yes/2024 :alt: Maintenance .. |pypi-downloads| image:: https://img.shields.io/pypi/dm/formate diff --git a/doc-source/conf.py b/doc-source/conf.py index e95dbfd..3f6b06a 100644 --- a/doc-source/conf.py +++ b/doc-source/conf.py @@ -71,11 +71,32 @@ } +# Fix for pathlib issue with sphinxemoji on Python 3.9 and Sphinx 4.x +def copy_asset_files(app, exc): + # 3rd party + from domdf_python_tools.compat import importlib_resources + from sphinx.util.fileutil import copy_asset + + if exc: + return + + asset_files = ["twemoji.js", "twemoji.css"] + for path in asset_files: + path_str = os.fspath(importlib_resources.files("sphinxemoji") / path) + copy_asset(path_str, os.path.join(app.outdir, "_static")) + + def setup(app): # 3rd party from sphinx_toolbox.latex import better_header_layout + from sphinxemoji import sphinxemoji app.connect("config-inited", lambda app, config: better_header_layout(config)) + app.connect("build-finished", copy_asset_files) + app.add_js_file("https://unpkg.com/twemoji@latest/dist/twemoji.min.js") + app.add_js_file("twemoji.js") + app.add_css_file("twemoji.css") + app.add_transform(sphinxemoji.EmojiSubstitutions) # 3rd party from sphinx_toolbox.latex import replace_unknown_unicode diff --git a/doc-source/index.rst b/doc-source/index.rst index fb1290e..51e847d 100644 --- a/doc-source/index.rst +++ b/doc-source/index.rst @@ -112,14 +112,14 @@ formate :alt: GitHub top language .. |commits-since| github-shield:: - :commits-since: v0.7.0 + :commits-since: v0.8.0 :alt: GitHub commits since tagged version .. |commits-latest| github-shield:: :last-commit: :alt: GitHub last commit - .. |maintained| maintained-shield:: 2023 + .. |maintained| maintained-shield:: 2024 :alt: Maintenance .. |pypi-downloads| pypi-shield:: diff --git a/doc-source/requirements.txt b/doc-source/requirements.txt index 3a6caf0..55e86da 100644 --- a/doc-source/requirements.txt +++ b/doc-source/requirements.txt @@ -2,7 +2,7 @@ git+https://github.com/domdfcoding/sphinx-click.git git+https://github.com/sphinx-toolbox/sphinx-toolbox-experimental.git default-values>=0.6.0 extras-require>=0.5.0 -furo>=2020.11.19b18 +furo==2021.06.18b36 html-section>=0.3.0 seed-intersphinx-mapping>=1.2.2 sphinx>=3.0.3 @@ -11,10 +11,14 @@ sphinx-debuginfo>=0.2.2 sphinx-favicon>=0.2 sphinx-licenseinfo>=0.3.1 sphinx-notfound-page>=0.7.1 -sphinx-prompt>=1.1.0 sphinx-pyproject>=0.1.0 -sphinx-tabs>=1.1.13 sphinx-toolbox>=3.5.0 +sphinxcontrib-applehelp==1.0.4 +sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-httpdomain>=1.7.0 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-serializinghtml==1.1.5 sphinxemoji>=0.2.0 toctree-plus>=0.6.1 diff --git a/doc-source/usage.rst b/doc-source/usage.rst index 7cb5c14..106d78a 100644 --- a/doc-source/usage.rst +++ b/doc-source/usage.rst @@ -26,7 +26,7 @@ To do so, add the following to your `.pre-commit-config.yaml `_ file: .. pre-commit:: - :rev: 0.7.0 + :rev: 0.8.0 :hooks: formate :args: --verbose diff --git a/formate.toml b/formate.toml index cda9aec..bcb7547 100644 --- a/formate.toml +++ b/formate.toml @@ -6,21 +6,17 @@ noqa-reformat = 60 ellipsis-reformat = 70 squish_stubs = 80 -[config] -indent = "\t" -line_length = 115 - [hooks.yapf] priority = 30 -[hooks.isort] -priority = 50 - [hooks.yapf.kwargs] yapf_style = ".style.yapf" +[hooks.isort] +priority = 50 + [hooks.isort.kwargs] -indent = "\t\t" +indent = " " multi_line_output = 8 import_heading_stdlib = "stdlib" import_heading_thirdparty = "3rd party" @@ -55,4 +51,8 @@ known_third_party = [ "typing_extensions", "yapf", ] -known_first_party = "formate" +known_first_party = [ "formate",] + +[config] +indent = " " +line_length = 115 diff --git a/formate/__init__.py b/formate/__init__.py index 9660ef8..507ddca 100644 --- a/formate/__init__.py +++ b/formate/__init__.py @@ -49,7 +49,7 @@ __author__: str = "Dominic Davis-Foster" __copyright__: str = "2020-2021 Dominic Davis-Foster" __license__: str = "MIT License" -__version__: str = "0.7.0" +__version__: str = "0.8.0" __email__: str = "dominic@davis-foster.co.uk" __all__ = ("call_hooks", "reformat_file", "Reformatter", "isort_hook", "yapf_hook") diff --git a/formate/reformat_generics.py b/formate/reformat_generics.py index e52cbbd..ee53c96 100644 --- a/formate/reformat_generics.py +++ b/formate/reformat_generics.py @@ -158,13 +158,15 @@ def visit(self, node: ast.AST) -> typing.List[typing.Tuple[ast.Subscript, Generi super().visit(node) return self.unions - def visit_FunctionDef(self, node: ast.FunctionDef) -> None: + @staticmethod + def visit_FunctionDef(node: ast.FunctionDef) -> None: return None def visit_ClassDef(self, node: ast.ClassDef) -> None: self.unions.extend(ClassVisitor().visit(node)) - def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None: + @staticmethod + def visit_AsyncFunctionDef(node: ast.AsyncFunctionDef) -> None: return None @@ -221,16 +223,19 @@ def visit_List(self, node: ast.List) -> None: elements.extend(UnionVisitor().visit(child)) self.structure.append(List(elements)) - def visit_Load(self, node: ast.Load) -> None: + @staticmethod + def visit_Load(node: ast.Load) -> None: return None - def visit_FunctionDef(self, node: ast.FunctionDef) -> None: + @staticmethod + def visit_FunctionDef(node: ast.FunctionDef) -> None: return None def visit_ClassDef(self, node: ast.ClassDef) -> None: self.generic_visit(node) - def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None: + @staticmethod + def visit_AsyncFunctionDef(node: ast.AsyncFunctionDef) -> None: return None if sys.version_info[:2] < (3, 8): # pragma: no cover (py38+) diff --git a/formate/utils.py b/formate/utils.py index 0e85e14..9f695f2 100644 --- a/formate/utils.py +++ b/formate/utils.py @@ -166,11 +166,13 @@ class SyntaxTracebackHandler(TracebackHandler): Subclass of :class:`consolekit.tracebacks.TracebackHandler` to additionally handle :exc:`SyntaxError`. """ - def handle_SyntaxError(self, e: SyntaxError) -> "NoReturn": # noqa: D102 + @staticmethod + def handle_SyntaxError(e: SyntaxError) -> "NoReturn": # noqa: D102 click.echo(terminal_colours.Fore.RED(f"Fatal: {e.__class__.__name__}: {e}"), err=True) sys.exit(126) - def handle_HookNotFoundError(self, e: HookNotFoundError) -> "NoReturn": # noqa: D102 + @staticmethod + def handle_HookNotFoundError(e: HookNotFoundError) -> "NoReturn": # noqa: D102 click.echo(terminal_colours.Fore.RED(f"Fatal: Hook not found: {e}"), err=True) sys.exit(126) diff --git a/pyproject.toml b/pyproject.toml index 4753774..4167f69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,20 +4,19 @@ build-backend = "whey" [project] name = "formate" -version = "0.7.0" +version = "0.8.0" description = "Python formatting mate." readme = "README.rst" keywords = [ "formatting", "linting",] dynamic = [ "requires-python", "classifiers", "dependencies",] +[project.license] +file = "LICENSE" + [[project.authors]] name = "Dominic Davis-Foster" email = "dominic@davis-foster.co.uk" - -[project.license] -file = "LICENSE" - [project.urls] Homepage = "https://github.com/python-formate/formate" "Issue Tracker" = "https://github.com/python-formate/formate/issues" @@ -27,6 +26,16 @@ Documentation = "https://formate.readthedocs.io/en/latest" [project.scripts] formate = "formate.__main__:main" +[project.entry-points.formate_hooks] +reformat-generics = "formate.reformat_generics:reformat_generics" +dynamic_quotes = "formate.dynamic_quotes:dynamic_quotes" +noqa_reformat = "formate.mini_hooks:noqa_reformat" +squish_stubs = "formate.mini_hooks:squish_stubs" +ellipsis_reformat = "formate.ellipses:ellipsis_reformat" +collections-import-rewrite = "formate.imports:rewrite_collections_abc_imports" +isort = "formate:isort_hook" +yapf = "formate:yapf_hook" + [tool.whey] base-classifiers = [ "Development Status :: 4 - Beta", @@ -46,6 +55,9 @@ extras = "all" [tool.dep_checker] allowed_unused = [ "prettyprinter",] +[tool.dep_checker.name_mapping] +attrs = "attr" + [tool.sphinx-pyproject] github_username = "python-formate" github_repository = "formate" @@ -67,7 +79,6 @@ extensions = [ "sphinx.ext.mathjax", "sphinxcontrib.extras_require", "sphinx.ext.todo", - "sphinxemoji.sphinxemoji", "notfound.extension", "sphinx_copybutton", "sphinxcontrib.default_values", @@ -84,7 +95,6 @@ extensions = [ "sphinx_toolbox_experimental.missing_xref", "local_extension", ] -sphinxemoji_style = "twemoji" gitstamp_fmt = "%d %b %Y" templates_path = [ "_templates",] html_static_path = [ "_static",] @@ -145,18 +155,15 @@ show_error_codes = true [tool.snippet-fmt] directives = [ "code-block",] -[project.entry-points.formate_hooks] -reformat-generics = "formate.reformat_generics:reformat_generics" -dynamic_quotes = "formate.dynamic_quotes:dynamic_quotes" -noqa_reformat = "formate.mini_hooks:noqa_reformat" -squish_stubs = "formate.mini_hooks:squish_stubs" -ellipsis_reformat = "formate.ellipses:ellipsis_reformat" -collections-import-rewrite = "formate.imports:rewrite_collections_abc_imports" -isort = "formate:isort_hook" -yapf = "formate:yapf_hook" +[tool.snippet-fmt.languages.python] +reformat = true -[tool.dep_checker.name_mapping] -attrs = "attr" +[tool.snippet-fmt.languages.TOML] +reformat = true + +[tool.snippet-fmt.languages.ini] + +[tool.snippet-fmt.languages.json] [tool.dependency-dash."requirements.txt"] order = 10 @@ -168,13 +175,3 @@ include = false [tool.dependency-dash."doc-source/requirements.txt"] order = 30 include = false - -[tool.snippet-fmt.languages.python] -reformat = true - -[tool.snippet-fmt.languages.TOML] -reformat = true - -[tool.snippet-fmt.languages.ini] - -[tool.snippet-fmt.languages.json] diff --git a/repo_helper.yml b/repo_helper.yml index 8fc357d..6da36a6 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -6,7 +6,7 @@ author: 'Dominic Davis-Foster' email: 'dominic@davis-foster.co.uk' username: 'python-formate' assignee: 'domdfcoding' -version: '0.7.0' +version: '0.8.0' license: 'MIT' short_desc: 'Python formatting mate.' primary_conda_channel: "domdfcoding" diff --git a/requirements.txt b/requirements.txt index 64c012e..95c151a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,4 +9,4 @@ domdf-python-tools>=2.5.0 isort>=5.5.2 prettyprinter>=0.18.0 typing-extensions>=3.7.4.3 -yapf>=0.30.0 +yapf>=0.30.0,<0.43.0 diff --git a/tox.ini b/tox.ini index 84a590f..a221395 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ # * testenv # * testenv:.package # * testenv:py313-dev +# * testenv:py313 # * testenv:py312-dev # * testenv:py312 # * testenv:docs @@ -81,11 +82,14 @@ setenv = PIP_DISABLE_PIP_VERSION_CHECK=1 [testenv:py313-dev] +download = True setenv = PYTHONDEVMODE=1 PIP_DISABLE_PIP_VERSION_CHECK=1 + UNSAFE_PYO3_SKIP_VERSION_CHECK=1 [testenv:py312] +download = True setenv = PYTHONDEVMODE=1 PIP_DISABLE_PIP_VERSION_CHECK=1 @@ -103,6 +107,7 @@ setenv = PYTHONDEVMODE=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_PREFER_BINARY=1 + UNSAFE_PYO3_SKIP_VERSION_CHECK=1 skip_install = True changedir = {toxinidir} deps = @@ -130,7 +135,7 @@ deps = flake8-github-actions>=0.1.0 flake8-noqa>=1.1.0,<=1.2.2 flake8-pyi>=20.10.0,<=22.8.0 - flake8-pytest-style>=1.3.0 + flake8-pytest-style>=1.3.0,<2 flake8-quotes>=3.3.0 flake8-slots>=0.1.0 flake8-sphinx-links>=0.0.4 @@ -227,8 +232,8 @@ exclude_lines = raise NotImplementedError if 0: if False: - if TYPE_CHECKING: - if typing.TYPE_CHECKING: + if TYPE_CHECKING + if typing.TYPE_CHECKING if __name__ == .__main__.: [check-wheel-contents] @@ -255,3 +260,4 @@ setenv = setenv = PYTHONDEVMODE=1 PIP_DISABLE_PIP_VERSION_CHECK=1 + UNSAFE_PYO3_SKIP_VERSION_CHECK=1