Metrolith
Evidence, not scores.
Metrolith helps repository maintainers and researchers understand their code and evaluate rules they choose, with measurements they can inspect.
Languages: Java, JavaScript/TypeScript, Python and Go.
It records versioned evidence for code lines, source files, classes/structs, methods/functions and complexity. Maintenance analyses are optional.
Prerequisites
Requires CPython 3.13. Release verification is currently performed with 3.13.9 on x86-64 Windows and Ubuntu.
Git must be on PATH. The current source-acquisition workflow requires it even for directory snapshots. Your source directory does not need to be a Git repository.
Install
Install from a source checkout or a local wheel using the instructions below.
Start in the downloaded or cloned source root (containing pyproject.toml). Use CPython 3.13 and an unused sibling environment directory; stop if either prerequisite check fails. The commands below install Metrolith and its dependencies, including native tree-sitter parsers, and make metrolith available in the current shell. Installation can download dependencies.
PowerShell — python must resolve to CPython 3.13:
python --version
git --version
python -m venv ../metrolith-user
& ../metrolith-user/Scripts/python.exe -m pip install --require-hashes -r requirements/install-tooling.lock
& ../metrolith-user/Scripts/python.exe -m pip install .
$env:PATH = "$((Resolve-Path '../metrolith-user/Scripts').Path);$env:PATH"
Ubuntu shell:
python3.13 --version
git --version
python3.13 -m venv ../metrolith-user
../metrolith-user/bin/python -m pip install --require-hashes -r requirements/install-tooling.lock
../metrolith-user/bin/python -m pip install .
source ../metrolith-user/bin/activate
PowerShell's PATH change is session-only; no execution-policy change is needed. See Usage for local-wheel installation and troubleshooting.
Check the installed environment:
metrolith doctor --format text
Analyze your project
In the same configured shell, change to your project's source directory and run:
metrolith analyze .
A Run directory holds the results and evidence for an analysis; the command prints its path. By default, Runs are written under metrolith-output/runs/ in the invocation workspace (METROLITH_HOME or the current directory). Analysis leaves analyzed source files unchanged; it writes generated outputs and cache/workspace state. See source and output locations for overrides.
Inspect the results
Open the printed Run directory's summary.md for the summary and measurement states.
Replace RUN below with that printed directory. Keep the quotes around the path.
| Command | Purpose |
|---|---|
metrolith report "RUN" |
Build a static offline HTML view at RUN/report.html. |
metrolith explain "RUN" |
Explain recorded diagnostics and measurement availability. |
metrolith validate "RUN" |
Check required artifacts and cross-file measurement consistency. |
Validation checks recorded evidence; it does not rerun analysis or establish repository authenticity. The HTML report is a derived view. The Run also contains JSON/CSV evidence, per-subject fact sheets and per-language details in language_metrics.csv.
Optional: verify your installation
From an empty working directory, this command runs the packaged example without network access. Git must remain available.
metrolith example run --local
Recorded output from the bundled synthetic example:
Subject key example:network-free
Source directory snapshot (non-Git)
Overall status complete
Lines of Code 22 (complete)
Source Files 2 (complete)
Classes/Structs 0 (complete)
Methods/Functions 4 (complete)
Zero classes is a measured result, not missing data. This example illustrates the output; it is not a benchmark. Use its newly printed Run path with the inspection commands above.
Evidence and limits
Source state. Directory snapshots, Git working snapshots, tracked-only snapshots and exact Git revisions have different source identities. Each Run records its source identity; a working snapshot is not proof of committed bytes.
Measurement status. Complete, partial, unavailable, not requested and measured zero are different outcomes. A successful analysis can contain partial measurements; inspect the recorded statuses rather than relying on the exit code alone.
Your rules. A policy is a set of measurement rules you provide. metrolith check evaluates it; Metrolith does not supply universal quality thresholds or infer architecture labels. metrolith dossier combines accepted evidence into a report. A local PASS does not establish organizational approval. See Policy and trust requirements for these workflows.
See Reproducibility for source identity, output comparisons and environment limitations. The separately implemented hosted website is not installed by this package.
Documentation and development
- Usage: source modes, policies, Ratchet, safe exports and the full command/version reference.
- Examples: local samples and optional repository examples.
- Development: pinned build, test and artifact-validation environments, using requirements/release-verification.lock and tools/release_verify.py for deliberate full release verification.
- Release checklist: maintainer publication checks.
Technical references: metrics, complexity and artifact contracts.
The package is metrolith. The deprecated archlens and arch-bench commands, archlens_json import, legacy configuration keys and format identifiers remain for compatibility.
License, citation and contact
Apache-2.0 · Software citation
Maintainer: Ali Sajedifar — its.alisajedifar@gmail.com.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file metrolith-4.0.0.tar.gz.
File metadata
- Download URL: metrolith-4.0.0.tar.gz
- Upload date:
- Size: 9.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c93efa7485c5a2a38ae5904069e8abbd2a5fadeec1a72b781248f6df955c95f
|
|
| MD5 |
04799782c2cc7e024ff48ebe770e5368
|
|
| BLAKE2b-256 |
908dc409663087abaed990a0969d7a64f3c21c874c7969cfe211bf8ba0486840
|
Provenance
The following attestation bundles were made for metrolith-4.0.0.tar.gz:
Publisher:
publish-pypi.yml on AliSajedifar/metrolith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
metrolith-4.0.0.tar.gz -
Subject digest:
0c93efa7485c5a2a38ae5904069e8abbd2a5fadeec1a72b781248f6df955c95f - Sigstore transparency entry: 2822990659
- Sigstore integration time:
-
Permalink:
AliSajedifar/metrolith@0fba1c9d0b57fa16524ca8bb9ac4315430442f95 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AliSajedifar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@0fba1c9d0b57fa16524ca8bb9ac4315430442f95 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file metrolith-4.0.0-py3-none-any.whl.
File metadata
- Download URL: metrolith-4.0.0-py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bddeca14d71485529f54c5639c43d0ba193694a45a011b93336751ac85c38a5a
|
|
| MD5 |
6c342d8583d94d46164328db80303b6e
|
|
| BLAKE2b-256 |
c2c59ca89ecde5746df1e8336bc79501bc6f7b3f7aab5f2ed2cd87c5d2085187
|
Provenance
The following attestation bundles were made for metrolith-4.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on AliSajedifar/metrolith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
metrolith-4.0.0-py3-none-any.whl -
Subject digest:
bddeca14d71485529f54c5639c43d0ba193694a45a011b93336751ac85c38a5a - Sigstore transparency entry: 2822990673
- Sigstore integration time:
-
Permalink:
AliSajedifar/metrolith@0fba1c9d0b57fa16524ca8bb9ac4315430442f95 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AliSajedifar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@0fba1c9d0b57fa16524ca8bb9ac4315430442f95 -
Trigger Event:
workflow_dispatch
-
Statement type: