Skip to main content

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.

PowerShellpython 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

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 Sajedifarits.alisajedifar@gmail.com.

Source · Issues

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metrolith-4.0.0.tar.gz (9.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metrolith-4.0.0-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

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

Hashes for metrolith-4.0.0.tar.gz
Algorithm Hash digest
SHA256 0c93efa7485c5a2a38ae5904069e8abbd2a5fadeec1a72b781248f6df955c95f
MD5 04799782c2cc7e024ff48ebe770e5368
BLAKE2b-256 908dc409663087abaed990a0969d7a64f3c21c874c7969cfe211bf8ba0486840

See more details on using hashes here.

Provenance

The following attestation bundles were made for metrolith-4.0.0.tar.gz:

Publisher: publish-pypi.yml on AliSajedifar/metrolith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for metrolith-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bddeca14d71485529f54c5639c43d0ba193694a45a011b93336751ac85c38a5a
MD5 6c342d8583d94d46164328db80303b6e
BLAKE2b-256 c2c59ca89ecde5746df1e8336bc79501bc6f7b3f7aab5f2ed2cd87c5d2085187

See more details on using hashes here.

Provenance

The following attestation bundles were made for metrolith-4.0.0-py3-none-any.whl:

Publisher: publish-pypi.yml on AliSajedifar/metrolith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

4.0.1

2 files

This release

4.0.0 This release

2 files

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