scopio
Code metrics auditor with SQLite history, diffs and quality gates.
Features
- Audits code metrics (lines, complexity, warnings, languages) across multiple projects.
- Stores audit history in SQLite with diffs and quality gates.
- Analyzes high-risk code hotspots (Complexity x Churn) — see Hotspots Guide.
- Ingests external linter reports (Ruff, ESLint, Clippy, SARIF) — see Ingestion Cookbook.
- Exports results as JSON, CSV and Markdown.
- Compares audits and detects regressions for CI (
--fail-on-regression).
Install
pip install scopio
Requirements
- Python >= 3.11
lizard>= 1.24.0 (required for CSV parsing mode)scc>= 3.3.0 (optional, used for language/line counting) — the boyter/scc code counter, not the unrelated PyPIsccpackage:# Download a binary from https://github.com/boyter/scc/releases, or: go install github.com/boyter/scc/v3@latest
git(optional, used for metadata)
Quick Start
scopio --config scopio.toml run
All output artifacts (database, JSON, CSV, Markdown) are stored in the .scopio/ directory by default. Use --output-dir to override.
If scc or lizard versions differ from the expected range, a non-blocking tool_version_diverge warning is emitted in the logs.
Usage
Run audit
scopio --config scopio.toml run
scopio --config scopio.toml run --verbose
scopio --config scopio.toml run --incremental
Report history
scopio report --project my-project --limit 10
Diff between audits
scopio diff --project my-project
Diff report with file-level detail
scopio diff-report --project my-project --files --threshold-ccn 6
CI integration
scopio ci --project my-project --fail-on-regression
Clean old audits
scopio clean --keep 50
Archive old data
scopio archive --older-than 2026-01-01 --format csv
Initialize config
scopio init
Configuration
[discovery]
ignore_hidden = true
projects = ["my-project"]
[filters]
global_dirs = ["node_modules", "target", "dist", "build"]
minified_files = ["*.min.js", "*.min.css"]
ignored_langs = ["JSON", "Markdown", "TOML"]
[quality_gates]
max_ccn = 10.0 # average CCN per function
max_function_ccn = 15.0 # worst function complexity (disabled if omitted)
max_warnings = 10
max_ccn_trend_increase = 0.2
trend_sensitive_projects = []
[quality_gates.per_project]
# "my-project" = { max_ccn = 12.0, max_warnings = 15, max_function_ccn = 20.0 }
[quality_gates.per_language]
# Python = { max_ccn = 12.0, max_warnings = 20 }
[ci]
max_loc_trend_increase = 0.0 # fail if LOC grows above this ratio (0.0 = any growth)
Audit behavior
- Each audit run creates/updates a single row per
(project, branch, commit_hash). - Same commit, same branch: metrics are upserted (updated) and
runs_countis incremented. This avoids data staleness when re-running on the same commit (e.g. after changing.scopio.tomlfilters). - Different commit: a new row is created with
runs_count = 1. - The
runs_countfield is exposed inreport, CSV, JSON and Markdown exports. - Diff and CI comparisons compare the previous audit against the current one by default (use
--base firstto compare against the very first audit). - Quality gates use the current audit's values; the trend gate compares against the previous historical audit.
What the numbers mean
- LOC: source lines of code counted by
scc. - NLOC: logical lines of code counted by
lizard. LOC and NLOC are intentionally different metrics (different counting methodologies). - CCN (avg): cyclomatic complexity averaged over all functions. Averages hide outliers.
- ccn_max /
max_function_ccn: cyclomatic complexity of the worst single function — this is what the per-function quality gate checks. - warnings: currently always
0— thelizard --csvformat does not emit warnings. Language-specific warning adapters (clippy, eslint, ruff) are planned. - file_metrics: stored per-function in the database; the granular
diff-reportaggregates them per file (NLOC sum, CCN max).
GitHub Actions
name: Scopio
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
scopio:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install Python
run: uv python install 3.11
- name: Install scopio
run: pip install scopio
- name: Run scopio
run: scopio ci --project my-project --fail-on-regression
Development
This project uses uv as the Python toolchain.
See CONTRIBUTING.md for the commit convention and release workflow.
Architecture and scope decisions are recorded in docs/DECISIONS.md.
# Sync dependencies and create a virtual environment
uv sync
# Run tests
uv run pytest
# Run a lint check
uv run ruff check
# Run scopio locally
uv run scopio --help
Semantic Versioning
This project adheres to Semantic Versioning.
License
Metadata
Release files for scopio 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scopio-0.7.0.tar.gz | 133.9 kB | With provenance | Details for scopio-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scopio-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for scopio-0.7.0-py3-none-any.whl |
Total release size: 166.4 kB
Release files / scopio-0.7.0.tar.gz
| Download URL | scopio-0.7.0.tar.gz |
|---|---|
| Size | 133.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1e0384f7311d14fa3ab3b638b51e0532e53f90835a6862f608b5e4a8fd97621
|
|
BLAKE2b-256 checksum How to use checksums |
8fd7a4945e80a0a34783ec87ac0ecb4854292c6def4f4d3864b73af6bca2a849
|
| 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 30, 2026.
Transparency logRelease files / scopio-0.7.0-py3-none-any.whl
| Download URL | scopio-0.7.0-py3-none-any.whl |
|---|---|
| Size | 32.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e5c7ec241f5e601d4d71e042907bbf8435a185c88ba067cafdc738056235405
|
|
BLAKE2b-256 checksum How to use checksums |
8cfed6b20f9eb12797d6a8bdc010747279687fef4791de050c3152097148b41b
|
| 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 30, 2026.
Transparency logSecurity for scopio 0.7.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for scopio-0.7.0.tar.gz
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 30, 2026.
Transparency logA 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.