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

$ 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. A Chinese translation is available.

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. A practical path:

  1. Gate pull requests with --base so new changes are held to the policy.
  2. Work through the --all findings over time: fix the code first.
  3. Treat threshold, exclusion and owner changes as architecture decisions, each with its own full audit and review. A staged policy change is refused until that audit passes.

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:

{
  "version": 2,
  "include": ["src/*", "tests/*"],
  "exclude": [],
  "checkers": {
    "function_size": {"lines": 50, "complexity": 10},
    "architecture.import": {
      "boundaries": [
        {
          "name": "domain does not depend on adapters",
          "sources": ["src/domain/*"],
          "forbidden_imports": ["adapters", "adapters.*"]
        }
      ]
    }
  }
}

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. 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.

Agent review rules are a programmatic extension point: they are registered in Python, not enabled from the JSON policy, and invoke an ACP agent that submits findings through MCP tools. See Agent review.

Development

Set up a development environment from this checkout:

python -m pip install --no-cache-dir uv==0.8.22
uv sync --locked --group dev
. .venv/bin/activate

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.2

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.2
File Size Uploaded Provenance Actions
pluvy-0.0.2.tar.gz 292.4 kB Without provenance Details for pluvy-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 464.6 kB

Release files / pluvy-0.0.2.tar.gz

Download URL pluvy-0.0.2.tar.gz
Size 292.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cbed689e5eaad774af8f1d09840f203518c852b45cce8bae10e9bc8839713b15
BLAKE2b-256 checksum
How to use checksums
5ab5c52d50ec8d4828c427473ea47dc6576e8db4c4794d7f4c38addad2019802
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.2-py3-none-any.whl

Download URL pluvy-0.0.2-py3-none-any.whl
Size 172.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afcda7773ecc77c0a04930a913a624946d5024ac66c1e4eed4833014c70a091d
BLAKE2b-256 checksum
How to use checksums
d0c774e4f456589a18294070592dcef10c00d5c02dfe78b42273a4caf52201c9
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.2

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