Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Coverage.py

$ coverage Community Low Risk
Ned Batchelder · Code & DevOps · Apache-2.0 · macos / linux / windows

coverage (Coverage.py) measures statement and branch coverage for Python programs and test suites. Its clean subcommands (coverage run, coverage report, coverage json, coverage xml) give agents direct machine-readable JSON summaries and strict threshold enforcement via --fail-under.

FCRS-1.0 Score
83 /100
Good
Medium Confidence
Zero-Friction Install
pip install coverage
CLI vs MCP Decision CLI Only

Local Python instrumentation and coverage reporter tightly coupled to the project virtualenv.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Clean, non-interactive subcommands and coverage json structured output, though JSON writes to a file (-o - writes to stdout) rather than defaulting to stdout.

  • coverage json -o - streams JSON coverage metrics to stdout
  • coverage report --fail-under provides deterministic gate exit codes
Trust & Safety 21 / 25

Zero credentials or network calls; writes .coverage locally and keeps reporting read-only.

  • coverage report is strictly read-only over .coverage
Setup & Portability 13 / 15

Installs everywhere Python runs via pip or uvx across macOS, Linux, and Windows.

  • Pure PyPI wheel distribution with C extension speedups
Utility & Efficiency 13 / 15

Supports branch coverage, subprocess tracking, and JSON/XML/LCOV/HTML outputs from one .coverage file.

  • Supports json, xml, lcov, and html exporters
Maintenance & Lineage 8 / 10

Maintained by Ned Batchelder (nedbat/coveragepy) for 20+ years under Apache-2.0.

  • Canonical Python coverage engine used by pytest-cov
Docs & Verifiability 7 / 10

Thorough documentation on Read the Docs and clean subcommand --help.

  • Detailed CLI reference at coverage.readthedocs.io

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No credentials required; records local .coverage SQLite data files inside the workspace.

Side Effects
Read-Only Local Write
Cost & Quotas

Apache-2.0 open-source Python tool; free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Coverage.py Agent Rules
- Run `coverage run -m pytest` inside the project virtualenv, then export `coverage json -o coverage.json` for structured parsing.
- Use `coverage report --fail-under=80` in verification gates.
- Avoid `coverage erase` unless resetting stale `.coverage` files intentionally.

Agent-Ready Command Recipes

Safe Read-Only Queries

Print coverage report with missing lines
coverage report -m

Reads an existing .coverage database and prints per-file coverage percentages and missing line ranges.

Controlled Writes & Previews

Run pytest under coverage and export JSON
coverage run -m pytest && coverage json -o coverage.json

Instruments Python execution into .coverage and exports structured per-file coverage metrics to coverage.json.

Strengths for Agents

  • + coverage json -o - streams structured file- and line-level coverage directly to stdout.
  • + Single .coverage artifact feeds text, JSON, XML, LCOV, and HTML reporters.
  • + --fail-under enforces coverage thresholds with clean exit codes.

Caveats & Pitfalls

  • ! coverage run mutates/overwrites .coverage in the working directory unless --data-file is customized.
  • ! Needs to be invoked inside the same Python environment as the test dependencies.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI