Skip to main content

Find drift between your pre-commit hooks and your GitHub Actions steps.

Project description

ciparity

English · Русский · 简体中文 · Español · Português

PyPI Python CI License

Your hooks passed. CI failed anyway. The two configs drifted apart: someone bumped ruff in .pre-commit-config.yaml and not in the workflow, someone added mypy --strict to CI only, someone added a hook CI never runs. The worse case is quieter: both sides green while a check stopped running months ago.

ciparity reads .pre-commit-config.yaml and your CI pipeline and prints where they disagree, then fixes the version drift for you. Static parsing only: no network, no Docker, no API keys, and it never runs your tools.

pip install ciparity
ciparity .
pre-commit hooks: 5   CI steps: 4

mypy     arguments differ: different arguments
           pre-commit: -
           ci:         --strict
ruff     version differs: pinned to different versions
           pre-commit: 0.5.0
           ci:         0.6.2
           fix:        rev v0.5.0 -> v0.6.2
vulture  not in pre-commit: runs in CI but is not a pre-commit hook
           ci:         ci.yml:test
python   python differs: pre-commit pins a python version CI never sets up
           pre-commit: 3.11
           ci:         3.12

4 difference(s).
1 can be fixed automatically: ciparity --fix
$ ciparity --fix
--- .pre-commit-config.yaml
+++ .pre-commit-config.yaml
@@ -2,7 +2,7 @@
   python: python3.11
 repos:
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: v0.5.0
+    rev: v0.6.2
     hooks:
       - id: ruff
         args: [--fix]

https://github.com/astral-sh/ruff-pre-commit: rev v0.5.0 -> v0.6.2

Wrote .pre-commit-config.yaml. 1 fixed, 3 left.

--fix edits .pre-commit-config.yaml as text, so comments, quotes and key order survive. It moves hooks onto the version CI already uses, because CI is the version every reviewer sees. Use --fix --dry-run to see the diff and write nothing.

Exit code is 1 when there are differences, so it works as a check.

What it looks for

Check Example
Tool in one side only vulture is a hook, no workflow runs it
Version drift hook rev: v0.5.0 against pip install ruff==0.6.2, fixable
Argument drift --strict passed in CI but not in the hook
Python version default_language_version: python3.11 while CI sets up only 3.12
Node version default_language_version: node 20.11.0 while CI sets up 22
Narrower in CI CI runs pre-commit run without --all-files, so it only sees the diff

Versions are read from hook rev:, from pip install tool==x, uv tool install, pipx install, npm i -g tool@x, and from the version: input of known actions such as astral-sh/ruff-action. Commands are found inside run: blocks, including behind uv run, uvx, poetry run, npx and python -m.

Usage

ciparity [path] [--fix [--dry-run]] [--json] [--ignore pytest,codespell] [--exit-zero]

As a pre-commit hook:

repos:
  - repo: https://github.com/Topicspot/ciparity
    rev: v0.2.0
    hooks:
      - id: ciparity

Deliberate non-goals and limits

  • Only GitHub Actions is parsed today. The parser layer is provider based, GitLab CI is next.
  • --fix only edits .pre-commit-config.yaml. It never rewrites your workflows.
  • Only tools it recognises are compared. File hygiene hooks like trailing-whitespace are ignored on purpose, nobody runs those in CI and reporting them would be noise.
  • If a workflow runs pre-commit run --all-files, the two sides are parity by definition and "missing in CI" findings are suppressed.
  • Composite actions and reusable workflows are not followed, so tools that only run inside them are invisible.
  • Flags such as --fix or --all-files are treated as mode flags and never reported.

Alternatives

  • pre-commit.ci runs your hooks as a service, which removes the drift instead of reporting it. If you can use it, use it.
  • act runs workflows locally, so you can see what CI does. It answers a different question and is much heavier.
  • zizmor and actionlint lint the workflow files themselves. They do not know your pre-commit config.

License

MIT

☕ Support the author

This project is free and MIT-licensed. If it saved you time, you can send a coffee.

USDT, Tron network (TRC-20) only:

TS9ywGeSyKQxiCszdKCHLR8DRAsnYCosNN
Другие языки / Other languages
  • Українська: проєкт безкоштовний. Якщо він заощадив вам час — можна підтримати автора, USDT у мережі Tron (TRC-20), адреса вище.
  • Русский: проект бесплатный. Если он сэкономил вам время, можно поддержать автора, USDT в сети Tron (TRC-20), адрес выше.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ciparity-0.2.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ciparity-0.2.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file ciparity-0.2.0.tar.gz.

File metadata

  • Download URL: ciparity-0.2.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ciparity-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5e4c8b14847dd052023d94e5eecdf75ecb5062e72ad1a07e976312806b0760c1
MD5 034df9a960effc00e92bebcd40233234
BLAKE2b-256 903b0fcd9486b2904f2f5c58f2ad728ef78545a0255dc6fe8989b08c44a9fff3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ciparity-0.2.0.tar.gz:

Publisher: release.yml on Topicspot/ciparity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ciparity-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ciparity-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ciparity-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63ebdc2412b6e80e54d2267d4299af16f0054be918b3079b7af212dba7b2fe9b
MD5 64995a80c12a49b4623e1ebcee88dc14
BLAKE2b-256 0a79760b5d0de442c6541b10e8903c1772b479b3da6631be0f85f7a1c603d377

See more details on using hashes here.

Provenance

The following attestation bundles were made for ciparity-0.2.0-py3-none-any.whl:

Publisher: release.yml on Topicspot/ciparity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page