From 12ea13527724fe1a235539c2137741403b4f19c2 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:26:58 +0100 Subject: [PATCH 1/6] MAINT: update lock files --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eaad89f..fa67843 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,14 +12,14 @@ repos: - id: check-useless-excludes - repo: https://github.com/ComPWA/policy - rev: 0.5.0 + rev: 0.5.3 hooks: - id: check-dev-files args: - --repo-name=sphinx-pybtex-etal-style - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.0 + rev: v0.7.1 hooks: - id: ruff args: [--fix] @@ -64,7 +64,7 @@ repos: - --in-place - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.15.1 + rev: v8.15.2 hooks: - id: cspell @@ -89,6 +89,6 @@ repos: - python - repo: https://github.com/ComPWA/pyright-pre-commit - rev: v1.1.385 + rev: v1.1.386 hooks: - id: pyright From 30e8f545f4a469a4a57b3c9b1b32a1acf34a49cf Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:26:58 +0100 Subject: [PATCH 2/6] FIX: remove `pre-commit-uv` from environment --- .cspell.json | 1 + CONTRIBUTING.md | 20 +++++++++++++++++++- pyproject.toml | 1 - 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.cspell.json b/.cspell.json index e67fa54..a0615f1 100644 --- a/.cspell.json +++ b/.cspell.json @@ -53,6 +53,7 @@ "mypy", "pybtex", "PyPA", + "pyproject", "PYTHONHASHSEED", "SymPy" ] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dae2803..69f5c5f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,8 +19,26 @@ uv sync source .venv/bin/activate ``` -Formatting and linting checks are automatically performed when committing changes. This is done with [pre-commit](https://pre-commit.com). To install the hooks in your local repository, run [`pre-commit install`](https://pre-commit.com/#3-install-the-git-hook-scripts) **once**: +Formatting and linting checks are automatically performed when committing changes. This is done with [pre-commit](https://pre-commit.com). To install the hooks in your local repository, run install `pre-commit` with `uv`: + +```shell +uv tool install pre-commit --with pre-commit-uv --force-reinstall +``` + +and [`pre-commit install`](https://pre-commit.com/#3-install-the-git-hook-scripts) **once**: ```shell pre-commit install --install-hooks ``` + +In addition, it may be handy to install `tox`: + +```shell +uv tool install tox --with tox-uv +``` + +If the repository provides a Tox configuration under [`pyproject.toml`](./pyproject.toml), you can see which jobs it defines with: + +```shell +tox list +``` diff --git a/pyproject.toml b/pyproject.toml index 96743d8..fc5ef40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,6 @@ mypy = [ "mypy", ] sty = [ - "pre-commit-uv", "ruff", "sphinx-pybtex-etal-style[format]", "sphinx-pybtex-etal-style[lint]", From ea1ee46fce251308a6ec070dfcadd9946f6482e8 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:26:59 +0100 Subject: [PATCH 3/6] MAINT: address Ruff issues --- src/sphinx_pybtex_etal_style/style.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphinx_pybtex_etal_style/style.py b/src/sphinx_pybtex_etal_style/style.py index a2e5790..e8b55a9 100644 --- a/src/sphinx_pybtex_etal_style/style.py +++ b/src/sphinx_pybtex_etal_style/style.py @@ -103,7 +103,7 @@ def format_isbn(self, e: Entry) -> Node: # noqa: ARG002 else: msg = ( f"Unknown unsrt_etal_isbn_resolver: {self.isbn_resolver}. Valid options" - f" are {', '.join(ISBNResolvers.__args__)}." # pyright:ignore[reportAttributeAccessIssue] + f" are {', '.join(ISBNResolvers.__args__)}." ) raise NotImplementedError(msg) return href[url, join["ISBN:", field("isbn", raw=True)]] From fb8835204d5f209ef115ebefad29a544bdf54541 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:26:59 +0100 Subject: [PATCH 4/6] FIX: remove developer dependencies from extras --- .github/workflows/ci.yml | 2 +- .pre-commit-config.yaml | 2 +- CONTRIBUTING.md | 2 +- pyproject.toml | 27 +++++++++++---------------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1b164a..79edf73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,4 +31,4 @@ jobs: if: inputs.specific-pip-packages == '' secrets: token: ${{ secrets.PAT }} - uses: ComPWA/actions/.github/workflows/pre-commit.yml@v2 + uses: ComPWA/actions/.github/workflows/pre-commit.yml@v2.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa67843..539a9bf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: check-useless-excludes - repo: https://github.com/ComPWA/policy - rev: 0.5.3 + rev: 0.5.5 hooks: - id: check-dev-files args: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69f5c5f..4a6b14c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ cd sphinx-pybtex-etal-style Now it's simply a matter of creating and activating the [virtual environment](https://docs.astral.sh/uv/pip/environments) with [`uv sync`](https://docs.astral.sh/uv/reference/cli/#uv-sync). The dependencies for the project are 'pinned' in each commit through the [`uv.lock` file](https://docs.astral.sh/uv/concepts/projects/#project-lockfile). ```shell -uv sync +uv sync --all-extras source .venv/bin/activate ``` diff --git a/pyproject.toml b/pyproject.toml index fc5ef40..b9c3289 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,22 +35,6 @@ maintainers = [{email = "compwa-admin@ep1.rub.de"}] name = "sphinx-pybtex-etal-style" requires-python = ">=3.9" -[project.optional-dependencies] -dev = ["sphinx-pybtex-etal-style[sty]"] -lint = [ - "ruff", - "sphinx-pybtex-etal-style[mypy]", -] -mypy = [ - "Sphinx", - "mypy", -] -sty = [ - "ruff", - "sphinx-pybtex-etal-style[format]", - "sphinx-pybtex-etal-style[lint]", -] - [project.readme] content-type = "text/markdown" file = "README.md" @@ -61,6 +45,17 @@ Documentation = "https://github.com/ComPWA/sphinx-pybtex-etal-style/blob/main/RE Source = "https://github.com/ComPWA/sphinx-pybtex-etal-style" Tracker = "https://github.com/ComPWA/sphinx-pybtex-etal-style/issues" +[dependency-groups] +dev = [ + "ruff", + {include-group = "style"}, +] +style = [ + "mypy", + {include-group = "types"}, +] +types = ["sphinx"] + [tool.setuptools] include-package-data = true license-files = ["LICENSE"] From 00ce9edff4a9f8250b8fafbf5649745f3323be1f Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:41:10 +0100 Subject: [PATCH 5/6] FIX; run `pyright` with `venv` --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index b9c3289..a992273 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,6 +117,8 @@ reportUnusedFunction = true reportUnusedImport = true reportUnusedVariable = true typeCheckingMode = "strict" +venv = ".venv" +venvPath = "." [tool.ruff] extend-include = ["*.ipynb"] From 02deec8c0b467ae7881ebbe10c0799045acad9a9 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:26:59 +0100 Subject: [PATCH 6/6] DX: recommend pull request VS Code extension --- .vscode/extensions.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index a57c6e3..5b49437 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,6 +6,7 @@ "editorconfig.editorconfig", "esbenp.prettier-vscode", "github.vscode-github-actions", + "github.vscode-pull-request-github", "mhutchie.git-graph", "ms-python.mypy-type-checker", "ms-python.python",