diff --git a/.copier-answers.yml b/.copier-answers.yml index 848ada6..d0e192a 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 16ecf4e +_commit: 1.0.0 _src_path: gh:pdhall99/python-project-template author_email: 20580126+pdhall99@users.noreply.github.com author_name: PD Hall diff --git a/.github/dependabot.yml b/.github/dependabot.yml index db89a5d..a11072c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,7 +16,8 @@ updates: patterns: ["*"] # When this bumps ruff-pre-commit, bump ruff in pyproject.toml's check-code - # group to the same version in the same pull request. + # group to the same version in the same pull request: the ruff-version hook + # fails until you do. - package-ecosystem: "pre-commit" directory: "/" schedule: diff --git a/.gitignore b/.gitignore index 176c3f7..d5b5c61 100644 --- a/.gitignore +++ b/.gitignore @@ -219,8 +219,7 @@ __marimo__/ # Streamlit .streamlit/secrets.toml -src/rocheometry/_version.py - -# Not covered above -.pyrefly_cache/ +# macOS .DS_Store + +src/rocheometry/_version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index de524b0..04b4352 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,9 +4,11 @@ default_language_version: # Generated by docs/figures.py, and checked byte for byte by docs:check. exclude: ^docs/site/recipes/figures/ +# Remote hooks are pinned to commit SHAs, like the workflow's actions, with the +# version in a "frozen" comment. Dependabot updates both together. repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 hooks: - id: check-added-large-files - id: check-merge-conflict @@ -27,12 +29,12 @@ repos: args: [--markdown-linebreak-ext=md] - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.31.2 + rev: 02ef6d1c28994054a843e58604e1a343faa42987 # frozen: v2.31.2 hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.17.6 # keep consistent with hatch config + rev: 9026c9127e153371d7a78dfcb0c45ae2046a3d10 # frozen: v0.17.6 hooks: # Run the linter - id: ruff-check @@ -44,17 +46,28 @@ repos: args: [--config=pyproject.toml] - repo: https://github.com/rhysd/actionlint - rev: v1.7.12 + rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12 hooks: - id: actionlint - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.33.1 + rev: c7d31dc612dffdd4d3b2f2b88b9660d3ab057ee8 # frozen: v1.33.1 hooks: - id: zizmor - repo: local hooks: + # Dependabot bumps ruff-pre-commit, but not ruff in pyproject.toml. + - id: ruff-version + name: ruff version matches pyproject.toml + language: system + entry: >- + bash -c 'v=$(grep -A1 "repo: https://github.com/astral-sh/ruff-pre-commit" .pre-commit-config.yaml + | grep -oE "v[0-9]+[.][0-9]+[.][0-9]+" | head -1 | tr -d v); + grep -q "\"ruff==$v\"" pyproject.toml || + { echo "Set ruff==$v in the check-code group in pyproject.toml, to match ruff-pre-commit"; exit 1; }' + files: ^(\.pre-commit-config\.yaml|pyproject\.toml)$ + pass_filenames: false - id: check-types name: check types entry: hatch check types diff --git a/AGENTS.md b/AGENTS.md index f64b4af..3292371 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,3 +1,3 @@ # Agent instructions -Follow the [contributor guide](docs/CONTRIBUTING.md), in particular [running commands](docs/CONTRIBUTING.md#running-commands). +Follow the [contributor guide](docs/CONTRIBUTING.md), in particular [Running commands](docs/CONTRIBUTING.md#running-commands). diff --git a/README.md b/README.md index e8fbfa3..3469aab 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Rocheometry is a dependency-free Python library that computes these surfaces dir ## Installation -`rocheometry` requires Python 3.11 or later (see [compatibility and versioning](#compatibility-and-versioning)). +`rocheometry` requires Python 3.11 or later (see [Compatibility and versioning](#compatibility-and-versioning)). It has no runtime dependencies by default. `rocheometry` is available from [PyPI](https://pypi.org/project/rocheometry/). diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index d4dda4f..89cab78 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -260,12 +260,12 @@ Once a version is on PyPI it cannot be uploaded again, so release any fix as a n ### Updating from the template -This project was generated from a [Copier](https://copier.readthedocs.io/) template, recorded with your answers to its questions in `.copier-answers.yml`. +This project was generated from a [Copier](https://copier.readthedocs.io/) template, recorded with your answers to its questions in `.copier-answers.yml`, where `_src_path` is the template's location. -To apply a newer version of the template, run +To apply a newer version of the template, run this from a clone of the template, giving the path to this project: ```shell -uvx copier update --defaults +hatch run update PATH ``` Review the changes and resolve any conflicts, where the project has changed the same lines as the template, then commit them through a pull request. @@ -278,7 +278,7 @@ Run every development command through Hatch, which manages the environments for - Don't skip pre-commit hooks or checks, for example with `git commit --no-verify` - Don't edit `src/rocheometry/_version.py`: it is generated from the git tag -- Commit any changes the checks make, as described in [checking your changes](#checking-your-changes) +- Commit any changes the checks make, as described in [Checking your changes](#checking-your-changes) ```shell hatch run pre-commit:install # Set up the pre-commit hooks diff --git a/docs/site/getting-started/installation.md b/docs/site/getting-started/installation.md index 139787e..cb34be7 100644 --- a/docs/site/getting-started/installation.md +++ b/docs/site/getting-started/installation.md @@ -4,7 +4,7 @@ description: "Install Rocheometry from PyPI: it needs Python 3.11 or later, has # Installation -`rocheometry` requires Python 3.11 or later (see [compatibility and versioning](../project/compatibility-and-versioning.md)). +`rocheometry` requires Python 3.11 or later (see [Compatibility and versioning](../project/compatibility-and-versioning.md)). It has no runtime dependencies by default. `rocheometry` is available from [PyPI](https://pypi.org/project/rocheometry/). diff --git a/pyproject.toml b/pyproject.toml index 4ce7ad8..1de3b0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,7 +98,7 @@ accuracy = [ "pyyaml>=6,<7", ] check-code = [ - "ruff==0.17.6", # keep consistent with pre-commit-config.yaml + "ruff==0.17.6", # checked by the ruff-version pre-commit hook ] check-fmt = [ { include-group = "check-code" }, @@ -131,9 +131,6 @@ local_scheme = "no-local-version" [tool.hatch.version] source = "vcs" -[tool.hatch.metadata] -allow-direct-references = true - [tool.hatch.build.hooks.vcs] version-file = "src/rocheometry/_version.py" @@ -182,7 +179,7 @@ dependencies = [] dependency-groups = [ "docs" ] [tool.hatch.envs.docs.scripts] -build = "zensical build" +build = "zensical build --strict" check = "python docs/figures.py check {args}" figures = "python docs/figures.py write {args}" serve = "zensical serve" @@ -308,9 +305,6 @@ quote-style = "double" # their provenance, so it waits for the next rebuild. "fits/common.py" = [ "D401" ] -[tool.ruff.lint.flake8-quotes] -inline-quotes = "double" - [tool.ruff.lint.pydocstyle] convention = "google" diff --git a/zensical.toml b/zensical.toml index 465b6cb..eaaa3e3 100644 --- a/zensical.toml +++ b/zensical.toml @@ -167,6 +167,7 @@ pymdownx.mark = {} pymdownx.smartsymbols = {} pymdownx.snippets.base_path = ["."] # pymdownx.snippets.base_path = "includes" +pymdownx.snippets.check_paths = true pymdownx.superfences.custom_fences = [ { name = "mermaid", class = "mermaid", format = "pymdownx.superfences.fence_code_format" }, ]