diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index 52a65b1..7c3b819 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -21,7 +21,7 @@ jobs: - run: cz check --rev-range origin/main..HEAD shell: bash - pre-commit-extras: + pre-commit: runs-on: ubuntu-latest steps: - name: Check out @@ -38,17 +38,9 @@ jobs: - run: poetry install --with=dev - - uses: pre-commit/action@v3.0.0 + - uses: actions/cache@v4 with: - extra_args: > - rich-codex - mypy - --all-files + path: ~/.cache/pre-commit + key: pre-commit-v0|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} - - uses: actions/upload-artifact@v4 - with: - name: assets - path: | - .assets/* - retention-days: 3 - if: always() + - run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8b28056..490bee6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ ci: autofix_prs: false autoupdate_schedule: quarterly autoupdate_commit_msg: 'build(pre-commit): [pre-commit.ci] pre-commit autoupdate' - skip: # see linters.yaml -> pre-commit-extras job + skip: # see linters.yaml -> pre-commit job - "rich-codex" - "mypy" diff --git a/poetry.lock b/poetry.lock index 91c7272..650b176 100644 --- a/poetry.lock +++ b/poetry.lock @@ -152,6 +152,17 @@ files = [ [package.dependencies] pycparser = "*" +[[package]] +name = "cfgv" +version = "3.4.0" +description = "Validate configuration and produce human readable error messages." +optional = false +python-versions = ">=3.8" +files = [ + {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, + {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, +] + [[package]] name = "charset-normalizer" version = "3.3.2" @@ -631,6 +642,20 @@ gitdb = ">=4.0.1,<5" [package.extras] test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest (>=7.3.1)", "pytest-cov", "pytest-instafail", "pytest-mock", "pytest-sugar", "sumtypes"] +[[package]] +name = "identify" +version = "2.5.33" +description = "File identification library for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "identify-2.5.33-py2.py3-none-any.whl", hash = "sha256:d40ce5fcd762817627670da8a7d8d8e65f24342d14539c59488dc603bf662e34"}, + {file = "identify-2.5.33.tar.gz", hash = "sha256:161558f9fe4559e1557e1bff323e8631f6a0e4837f7497767c1782832f16b62d"}, +] + +[package.extras] +license = ["ukkonen"] + [[package]] name = "idna" version = "3.6" @@ -1149,6 +1174,20 @@ files = [ {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, ] +[[package]] +name = "nodeenv" +version = "1.8.0" +description = "Node.js virtual environment builder" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" +files = [ + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, +] + +[package.dependencies] +setuptools = "*" + [[package]] name = "packaging" version = "23.2" @@ -1280,6 +1319,24 @@ files = [ poetry = ">=1.6.0,<2.0.0" poetry-core = ">=1.7.0,<2.0.0" +[[package]] +name = "pre-commit" +version = "3.6.0" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +optional = false +python-versions = ">=3.9" +files = [ + {file = "pre_commit-3.6.0-py2.py3-none-any.whl", hash = "sha256:c255039ef399049a5544b6ce13d135caba8f2c28c3b4033277a788f434308376"}, + {file = "pre_commit-3.6.0.tar.gz", hash = "sha256:d30bad9abf165f7785c15a21a1f46da7d0677cb00ee7ff4c579fd38922efe15d"}, +] + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +virtualenv = ">=20.10.0" + [[package]] name = "prompt-toolkit" version = "3.0.36" @@ -1856,6 +1913,22 @@ files = [ cryptography = ">=2.0" jeepney = ">=0.6" +[[package]] +name = "setuptools" +version = "69.0.3" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-69.0.3-py3-none-any.whl", hash = "sha256:385eb4edd9c9d5c17540511303e39a147ce2fc04bc55289c322b9e5904fe2c05"}, + {file = "setuptools-69.0.3.tar.gz", hash = "sha256:be1af57fc409f93647f2e8e4573a142ed38724b8cdd389706a867bb4efcf1e78"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "shellingham" version = "1.5.4" @@ -2085,4 +2158,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "72be8d632c9c05b48bd91379048fb9344ae1e8a48eb29f93cc6c7a90129b1aa0" +content-hash = "0db1dd0d7ab0bd4b157cc858d8aacb63b2c8d8d86a5a7958fc1ba13a51fe1695" diff --git a/pyproject.toml b/pyproject.toml index 194a754..3e348cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ ruff = "^0.1.14" mypy = "^1.8.0" rich-codex = "^1.2.7" commitizen = "^3.13.0" +pre-commit = "^3.6.0" [tool.poetry.group.tests.dependencies] diff --git a/tests/conftest.py b/tests/conftest.py index 75ec071..3c2bdad 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ import subprocess from pathlib import Path from shutil import rmtree +from typing import Iterator import pytest @@ -8,7 +9,7 @@ @pytest.fixture(scope="session") -def homebrew_tapdir(): +def homebrew_tapdir() -> Path: _repo_path = ( subprocess.check_output( ( @@ -24,7 +25,7 @@ def homebrew_tapdir(): @pytest.fixture() -def homebrew_fresh_tap(homebrew_tapdir: Path): +def homebrew_fresh_tap(homebrew_tapdir: Path) -> Iterator[Path]: rmtree(homebrew_tapdir, ignore_errors=True) (homebrew_tapdir / "Formula").mkdir(parents=True, exist_ok=True) (homebrew_tapdir / "README.md").touch()