Skip to main content

Pluvy

PyPI Python License

An engineering policy gate for code written by people and coding agents. Pluvy parses Python, Go, Java, JavaScript/JSX and TypeScript/TSX with tree-sitter and fails the build when a change erases type contracts, swallows errors, weakens or deletes tests, or crosses the architecture boundaries your repository declares.

Website: sectrend-cn.github.io/pluvy · Agent docs: llms.txt · llms-full.txt

$ pluvy --all
src/orders.py:4:25: type.broad: Do not erase contracts with typing.Any
tests/test_orders.py:5:5: test.tautology: Assertion in test_load cannot fail because it restates the same expression or a literal true. Assert an independently produced value or outcome instead.
tests/test_orders.py:6:5: warning: unused.return: Return value from 'load' is discarded
Diagnostic scope: full_files.
Usage reference scope: 2 files.
Architecture all: 2 files; 3 findings.

Why Pluvy

  • One policy, five languages. A single committed .pluvy/pluvy.json drives the same checkers across every supported language.
  • Architecture as data. Declare owners, placements and forbidden import directions; the gate enforces them on every change.
  • Built for agent-written code. It catches shortcuts that keep CI green without doing the work: tautological or assertion-free tests, deleted tests and eroded assertions, swallowed exceptions, literal fallback chains, casts and Any.
  • Change-aware. --base and --staged report only the definitions and statements a change touches, so existing debt does not block new work.
  • Read-only. No mode modifies, stages, stashes, restores or deletes source files, and none changes Git configuration. It is safe to run in CI, in hooks and inside agent sessions.

What it checks

22 checkers, all enabled by default:

Area Checkers
Type contracts type.broad, type.annotation, type.signature, type.boundary, type.assertion, type.contract
Test integrity test.integrity (tautological and vacuous tests), test.deletion (removed tests, assertion erosion, changed snapshots)
Error handling flow.handling (swallowed handlers, long ?? literal fallbacks)
Architecture architecture.owner, architecture.structure, architecture.import, architecture.dispatch, architecture.object_model
Dead code unused.parameter, unused.function, unused.field, unused.return
Structure and size function_size, structure.guarded_projection, imports.wildcard
Suppression hygiene type.suppression (foreign and malformed suppression directives)

Options, defaults, per-language coverage and known limits are listed in Checker configuration.

Quick start

Python 3.12 or newer is required. Install the published command line from PyPI:

uv tool install pluvy

Without uv, use python -m pip install pluvy. To try it once without installing, run uvx pluvy --all.

Add a policy to the repository you want to check and commit it:

mkdir -p .pluvy
echo '{"version": 2, "include": ["src/*", "tests/*"], "checkers": {}}' > .pluvy/pluvy.json

Then run one of the three modes:

pluvy --all                 # audit every selected file, including existing debt
pluvy --base origin/main    # audit only what changed since a commit
pluvy --staged              # audit the Git index before committing

Add --root /path/to/project to run from another directory and --format json for machine-readable output.

Exit code Meaning
0 No error findings; warnings may be present
1 At least one error finding
2 Configuration, encoding, filesystem or Git failure

Getting started covers installation options, building up a policy, triaging the first audit of an existing repository and per-task gating.

Adopting on an existing repository

The first --all on an existing codebase usually exits 1: that is the baseline reading, not a failure of the tool. Gate pull requests with --base so new changes are held to the policy immediately, and work through --all findings over time by fixing the code first. Treat threshold, exclusion and owner changes as architecture decisions: each requires its own --all audit and review before commit, and --staged refuses to run while a policy change is staged. Exceptions use an approved next-line suppression that names one rule and a reason; see comment suppressions.

Policy

Each target repository owns .pluvy/pluvy.json; paths inside it are relative to the repository root. Start from the example policy, which declares owners, an import boundary and size limits. Specify "enabled": false only to turn a checker off; omitted checkers and options keep their defaults.

Integration

Coding agents

The bundled skill in .agents/skills/pluvy/ tells an agent when the gate applies, which mode to run after a task and how to report the result. The PyPI package contains the tool only, so copy the skill from this repository into the consuming project's skills directory, or point to it from AGENTS.md. See Agent integration.

CI

Any CI system that can install a Python package can run the same commands. This repository gates itself in GitHub Actions.

Pre-commit

Once the policy is committed, a pre-commit hook can run pluvy --staged. The hook blocks commits that change the policy; see Discipline for changing the policy. Install hooks yourself; Pluvy never changes Git configuration.

Extending

Language plugins own suffixes and grammar interpretation; rules implement RuleBundle over a shared TreeContext. See Plugin architecture.

Development

Set up a development environment from this checkout (requires uv):

uv sync --locked --group dev
uv run --no-sync pytest -q

The required checks are listed in AGENTS.md and run in the engineering workflow. Shared code policy lives in Engineering standards.

License

MIT

Metadata

Release files for pluvy 0.0.4

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

Source distribution (sdist)

Source distribution for pluvy 0.0.4
File Size Uploaded Provenance Actions
pluvy-0.0.4.tar.gz 273.5 kB Without provenance Details for pluvy-0.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 435.0 kB

Release files / pluvy-0.0.4.tar.gz

Download URL pluvy-0.0.4.tar.gz
Size 273.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1e897f20baf88adbe30dc961fdb1794ce7d2f142d27ab6624c59b50821ad19aa
BLAKE2b-256 checksum
How to use checksums
9fed281fc1fd867dc599a54959a0eb807b23f18f7013d5a166b492d825f850d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pluvy-0.0.4-py3-none-any.whl

Download URL pluvy-0.0.4-py3-none-any.whl
Size 161.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8247cad7180c64b62ef27f53831c4a1e3fa1845e6d021942cba3fee9c9416272
BLAKE2b-256 checksum
How to use checksums
1a5dfa9a1cae4e78a2153e6e6273d6c4a8bfbe8e8f629acb590c6b1425ea0e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pluvy 0.0.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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