Skip to main content

Temporal code quality observatory — track metrics across git history to measure AI impact

Project description

NexTropy

Temporal code quality observatory -- track metrics across git history to measure AI impact.

Installation

pip install -e .

# Optional: enable LLM interpretation
pip install -e ".[llm]"

System Requirements

  • Python 3.12+
  • git -- used for history walking and worktree management
  • Node.js + npm (optional) -- enables TypeScript/JavaScript analysis. If missing, TS/JS files are silently skipped.

How to Use

Step 1 -- Scan the current codebase

Run a one-shot scan on your repository to compute quality metrics (cyclomatic complexity, SLOC, erosion ratio, etc.) and store a snapshot.

nextropy scan

Options:

  • --source-dir PATH -- directory to scan (default: auto-detected git root)
  • --format json|markdown|html -- output format (default: markdown)
  • --label "pre-AI" -- attach a human-readable label to the snapshot
  • --no-store -- print results without saving a snapshot

Step 2 -- Walk git history

Build a time-series of snapshots by scanning multiple points in your git history.

# Scan at every tag (default strategy)
nextropy history

# Only tags matching a pattern
nextropy history --tag-pattern "v*"

# Scan one commit per week
nextropy history --strategy weekly

# Scan one commit per month
nextropy history --strategy monthly

# Scan every commit (sampled down to --max-snapshots)
nextropy history --strategy commits

Strategies:

Strategy What it scans Useful when
tags (default) Every annotated or lightweight tag Releases are tagged
weekly One representative commit per ISO week You want regular time intervals
monthly One representative commit per month Long-lived repos with many commits
commits Every Nth commit (stride = total / max-snapshots) You need fine-grained history

Filtering and limits:

# Restrict to a date range
nextropy history --since 2024-01-01 --until 2024-06-30

# Cap the number of snapshots
nextropy history --strategy commits --max-snapshots 20

# Increase parallelism for faster scans
nextropy history --strategy monthly --parallelism 8

# Skip refs already stored (useful when re-running)
nextropy history --resume

# Attach a label to every snapshot
nextropy history --label "pre-AI"

Step 3 -- Check stored data

List all stored snapshots and their date ranges.

nextropy status

Step 4 -- Generate reports

Produce a report from stored snapshots.

# Markdown summary of the latest snapshot
nextropy report

# Interactive HTML dashboard with charts
nextropy report --format html

# Filter by date range
nextropy report --since 2024-01-01 --until 2024-06-30

# Include an AI-generated narrative (requires ANTHROPIC_API_KEY)
nextropy report --format html --with-llm

Step 5 -- Track metric trends

Follow a specific metric over time.

# Default: erosion_ratio
nextropy trend

# Track average cyclomatic complexity
nextropy trend --metric avg_cc

# With changepoint detection
nextropy trend --metric erosion_ratio --detect-changepoints

# JSON output for scripting
nextropy trend --metric total_sloc --format json

Available metrics: erosion_ratio, avg_cc, total_sloc, total_functions, high_functions, max_cc, p90_cc, total_files, total_mass, comment_density, test_to_code_ratio, boilerplate_ratio, naming_consistency, error_handling_entropy.

Step 6 -- Compare two refs

Side-by-side comparison of any two git refs (tags, branches, SHAs). NexTropy uses stored snapshots when available and scans on-the-fly otherwise.

nextropy compare v1.0 v2.0

# HTML output
nextropy compare main feat/refactor --format html

This also prints the AI Impact Index, a composite score indicating improvement or degradation.

Step 7 -- Detect anomalies

Flag unusual metric spikes or drops in the time-series using rolling z-scores.

nextropy anomaly

# Adjust sensitivity
nextropy anomaly --window 10 --threshold 3.0

Step 8 -- LLM interpretation

Get a natural-language narrative analysis of your metrics (requires ANTHROPIC_API_KEY).

# Interpret trends across all stored snapshots
nextropy interpret

# Focus on a specific topic
nextropy interpret --focus "erosion score trend"

# Interpret a comparison between two refs
nextropy interpret --compare v1.0 v2.0

Configuration

NexTropy reads settings from environment variables and .nextropy.toml. Key settings:

Variable Description
ANTHROPIC_API_KEY Enables LLM interpretation features
NEXTROPY_CC_THRESHOLD Cyclomatic complexity threshold for high-mass functions (default: 10)
NEXTROPY_EROSION_WARN Erosion ratio warning threshold
NEXTROPY_EROSION_BLOCK Erosion ratio that causes scan to exit with code 1

Project details


Download files

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

Source Distribution

nextropy-0.1.0.tar.gz (153.2 kB view details)

Uploaded Source

Built Distribution

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

nextropy-0.1.0-py3-none-any.whl (69.3 kB view details)

Uploaded Python 3

File details

Details for the file nextropy-0.1.0.tar.gz.

File metadata

  • Download URL: nextropy-0.1.0.tar.gz
  • Upload date:
  • Size: 153.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nextropy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6d084127a2801e047265a911a1b48c9e2b504d8d440772eda2cbe49b2101b9e
MD5 99c27483714b5512e245370783ffd521
BLAKE2b-256 e741666a3cd7435bf19eb82cc016233c2713b40ce3cf73a02cbc2b42fc3ef17c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nextropy-0.1.0.tar.gz:

Publisher: publish.yml on Nexapp/NexTropy

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

File details

Details for the file nextropy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nextropy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 69.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nextropy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8d3a05d84287fa5179cd19dca068ac68cfc96aec17518213d086353cf725a13
MD5 43c0bb2388ab7f7ce35dd3333ace167a
BLAKE2b-256 107eaf9a48ac74e1ea9f048017e75f9d67e9dfcd4c9e8193da17eb597f3d2350

See more details on using hashes here.

Provenance

The following attestation bundles were made for nextropy-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Nexapp/NexTropy

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page