Skip to main content

pyrigor

Disciplined Python patterns for catching bugs that type checkers and standard linters miss — inspired by safety-critical coding guidelines from other languages, adapted for a language and ecosystem they were not written for.

What this is

Python’s failure modes are often silent: implicit type coercion, positional-argument swaps between same-typed parameters, mutable default arguments, float equality checks, and tuple-unpacking that "type-checks" while being semantically wrong are all real, tool-catchable classes of bugs that slip past mypy, pylint, and ruff’s default rule sets.

pyrigor collects a set of guidelines — and, over time, tooling to enforce them — aimed at closing those gaps.

Status

Early stage. As of 2026-08, a set of documented guidelines. AST-based checks are in progress. Plugin integration (pylint, possibly ruff) is a future goal, not a current feature.

  • Guideline documentation
  • Standalone AST-based checkers (pre-commit local hooks) — PYR402 implemented. PYR201, PYR202, PYR401, PYR403 documented but not yet enforced.
  • pylint plugin
  • ruff plugin (stretch goal — contingent on learning Rust)

Usage

pip install pyrigor
pyrigor path/to/file.py [path/to/another.py ...]

Only PYR402 is enforced today. A violation exits non-zero and prints path:line:col: PYR402 message (keyword-only-arguments).

To suppress a specific violation, add a same-line comment with a reason:

def f(weight, bias):  # pyrigor: PYR402 # matches a fixed external API
    ...

Codes may be given as the full code (PYR402), the bare number (402), or the rule’s symbolic name (keyword-only-arguments). Multiple codes: # pyrigor: 402,403 # reason. A suppression comment without a reason is ignored, and a warning is printed.

Guidelines

See guidelines/ for the full list. Each guideline has a rule ID, rationale, example, and — once implemented — a link to its enforcing check.

Guidelines documented so far:

ID Rule Enforced by
PYR401 Use NamedTuple for any function returning more than one value Not yet implemented
PYR201 Use NewType for same-typed values at risk of being swapped Not yet implemented
PYR202 Use Enum instead of magic strings, ints, or bools for closed states Not yet implemented
PYR402 Force keyword-only arguments for 2+ function parameters (bare *) pyrigor CLI (pre-commit hook)
PYR403 Force keyword-only arguments for single-parameter functions Not yet implemented

Philosophy

Prefer explicit over implicit. Make illegal states unrepresentable. Do not rely on convention or code review where a tool can enforce correctness instead.

Contributing

See CONTRIBUTING.md for the setup and workflow.

License

MIT

Metadata

Release files for pyrigor 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrigor 0.1.1
File Size Uploaded
pyrigor-0.1.1.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyrigor 0.1.1
File Interpreter ABI Platform
pyrigor-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / pyrigor-0.1.1.tar.gz

Download URL pyrigor-0.1.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
39626300640d89e80b4196481a6d16ef2c5b02e8b82b087ed11a58dfaa275bde
BLAKE2b-256 checksum
How to use checksums
41bc37392d0fc8e9581756b15f21db091b33612927468bdb4116d0f8a349c29e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release files / pyrigor-0.1.1-py3-none-any.whl

Download URL pyrigor-0.1.1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f23da00827a9c3ef5c7576fbb55885f15aa3dc8e1a35bd534d3d30373ef9d0c7
BLAKE2b-256 checksum
How to use checksums
20ef331f2802339ec2adaabeedea6341417fb357e1665b0da206442d21a22b4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.1

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page