diff --git a/.copier-answers.yml b/.copier-answers.yml index 666db88..d2fadf4 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 5d5bf1b..1486df9 100644 --- a/.gitignore +++ b/.gitignore @@ -219,4 +219,7 @@ __marimo__/ # Streamlit .streamlit/secrets.toml +# macOS +.DS_Store + src/spanmark/_version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0817bdd..7ba1532 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,11 @@ default_language_version: python: python3.11 +# 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 @@ -24,12 +26,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 @@ -41,17 +43,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 36584c1..d953e6b 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Documents go in as Python dictionaries or JSONL, and annotations come out as JSO ## Installation -`spanmark` requires Python 3.11 or later (see [compatibility and versioning](#compatibility-and-versioning)). +`spanmark` requires Python 3.11 or later (see [Compatibility and versioning](#compatibility-and-versioning)). Install the latest release from [PyPI](https://pypi.org/project/spanmark/): diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 10da37c..925ad0d 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -231,12 +231,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. @@ -249,7 +249,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/spanmark/_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/pyproject.toml b/pyproject.toml index 5a83246..822e4e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ test = [ "pytest-sugar", "pytest-xdist[psutil]~=3.5", ] -check-code = [ "ruff==0.17.6" ] # keep consistent with pre-commit-config.yaml +check-code = [ "ruff==0.17.6" ] # checked by the ruff-version pre-commit hook check-fmt = [ { include-group = "check-code" } ] check-types = [ "pyrefly==1.5", { include-group = "test" } ] @@ -104,9 +104,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/spanmark/_version.py" @@ -194,9 +191,6 @@ quote-style = "double" [tool.ruff.lint.per-file-ignores] "__init__.py" = [ "F401" ] -[tool.ruff.lint.flake8-quotes] -inline-quotes = "double" - [tool.ruff.lint.pydocstyle] convention = "google"