Pre-commit mirror of crate-ci/typos.
This repository provides immutable release tags for using typos with
pre-commit.
The upstream typos repository uses multiple Git tagging conventions,
including the mutable v1 tag, semantic release tags, and tags belonging to
subpackages.
This can lead to undesirable results with pre-commit autoupdate, which may
select a mutable or unrelated upstream tag instead of a specific typos
release.
This mirror exposes stable typos package releases using immutable tags such
as:
v1.49.0v1.50.0v1.50.1
The typos hook intentionally behaves like the hook provided by
adhtruong/mirrors-typos.
Its defaults are:
entry: typos
language: python
types: [text]
args:
- --write-changes
- --force-excludeThis means that typos automatically applies unambiguous spelling
corrections.
Repository-specific exclusions and additional configuration should remain in
the consuming repository's .pre-commit-config.yaml.
Add the mirror to .pre-commit-config.yaml:
repos:
- repo: https://github.com/rdmorganiser/mirrors-typos
rev: v1.49.0
hooks:
- id: typosNo additional args are necessary to get the default autofix behavior.
For repositories which freeze pre-commit revisions to commit SHAs, such as RDMO, update with:
pre-commit autoupdate --freezeThis allows pre-commit to discover the latest semantic release tag from this mirror and then store the corresponding immutable commit SHA in the consuming repository.
The mirror keeps the release namespace under RDMO control while the typos
executable remains a platform-specific PyPI dependency:
PyPI release metadata
|
v
scripts/update_mirror.py
|
+--> pyproject.toml and .version
|
v
commit and vX.Y.Z tag
|
v
GitHub Actions atomic push
|
v
immutable mirror tag
|
v
pre-commit autoupdate --freeze in consuming repositories
The updater only reads PyPI metadata; it does not install or execute newly
published typos packages. The GitHub Actions workflow creates and pushes
the mirror commits and tags.
The mirror is maintained automatically by the Update mirror GitHub Actions
workflow.
The workflow reads the available releases of the typos Python package from
PyPI.
For every new stable X.Y.Z release after the version recorded in .version,
the workflow:
- updates the pinned
typosdependency inpyproject.toml; - updates
.version; - creates a commit named
Mirror: <version>; - creates an immutable
v<version>Git tag.
For example, updating from 1.49.0 to 1.50.0 creates:
Mirror: 1.50.0
and the corresponding tag:
v1.50.0
If several versions have been published since the previous workflow run, a separate commit and tag is created for each version.
The workflow can also be started manually from GitHub Actions.
This repository mirrors the pre-commit integration and release tags.
It does not contain or vendor the typos executable itself.
Each mirror release instead pins the corresponding typos Python package.
For example, tag v1.49.0 contains:
dependencies = [
"typos==1.49.0",
]When pre-commit installs the hook environment, that dependency installs the
appropriate typos package for the user's platform.
The mirror therefore provides control over the pre-commit repository and its
immutable release revisions while retaining the same installation mechanism
as adhtruong/mirrors-typos.
The first release tag must be created when the repository is bootstrapped.
For an initial .version of:
1.49.0
the initial repository commit should also be tagged:
git tag v1.49.0
git push origin main
git push origin v1.49.0After that, the update workflow maintains subsequent releases automatically.
In the next RDMO release, replace the upstream repository in
.pre-commit-config.yaml:
- repo: https://github.com/crate-ci/typos
+ repo: https://github.com/rdmorganiser/mirrors-typosKeep RDMO's existing hook exclusions. Then run:
pre-commit autoupdate --freezeThis resolves the mirror's latest semantic tag and stores its immutable commit SHA as the configured revision.
This mirror is based on the typos project from crate-ci and follows the
approach used by adhtruong/mirrors-typos.
The mirror infrastructure is maintained by the rdmorganiser community project.