skillfed

xenon

Monitor code metrics for Python on your CI server

xenon v0.9.3 1.4M downloads/30d#4,004 on PyPI
Permissive license MIT DORMANT released

What it is and what it does

Xenon is a command-line tool that wraps Radon to measure cyclomatic complexity across a Python codebase and enforce complexity thresholds. It calculates three metrics: average complexity across all blocks, per-module complexity, and absolute complexity of individual blocks, each ranked from A (simplest) to F (most complex). You set thresholds for each metric, and xenon exits with a non-zero code if any threshold is violated, making it suitable for blocking commits or failing CI builds when code becomes too complex.

Typically used in two contexts: as a pre-commit hook to prevent overly complex code from entering version control, or as a CI step to monitor complexity trends over time. It accepts glob patterns to exclude or ignore files and directories, and integrates with pre-commit frameworks. The package depends on radon for the actual complexity analysis, requests for potential HTTP operations, and PyYAML for configuration parsing.

Use it for:

  • Enforce complexity limits in a CI/CD pipeline to prevent code from becoming unmaintainable as features are added.
  • Block commits via a pre-commit hook when a developer introduces a function or module exceeding your team's complexity threshold.
  • Monitor average codebase complexity over time to catch gradual increases in technical debt.
  • Set per-module complexity caps to ensure no single module becomes a maintenance bottleneck.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Xenon monitors Python code complexity by measuring cyclomatic complexity across your codebase and fails your build when thresholds are exceeded, typically used in CI/CD pipelines and git commit hooks.

Yes, if you need lightweight complexity enforcement in CI or pre-commit workflows and can accept dormant maintenance. The package is stable and does one job well, but expect no active support or updates; if you require ongoing maintenance or advanced complexity analysis features, consider alternatives. No known vulnerabilities and low install friction make it a low-risk addition to existing pipelines.

Install

xenon on PyPI

pip

pip install xenon

uv

uv add xenon

poetry

poetry add xenon

Installing xenon

Before you install

Low friction install with three straightforward runtime dependencies (radon, requests, PyYAML). Maintenance is dormant—last release was 662 days ago—so expect no active bug fixes or feature updates, though the package remains functional for its narrow purpose.

License in practice

MIT license is permissive, allowing commercial and private use with minimal restrictions; you may use, modify, and distribute xenon freely as long as you include the license notice.

Quickstart

pip install xenon

xenon --max-absolute B --max-modules A --max-average A /path/to/code

Requires Python 2.7 or 3.6+ (classifiers indicate support through 3.12); xenon measures cyclomatic complexity via radon, so results depend on radon's analysis capabilities.

Verify before relying

  • Whether dormant maintenance (662 days since last release) affects compatibility with recent Python patch releases or modern CI platforms.
  • Whether the package's complexity thresholds (A–F ranks) align with your team's code quality standards without requiring custom configuration.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 3 — radon, requests, PyYAML
Maintenance dormant — 662 days since the last release
First released
Downloads 1,359,618/month — #4,004 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: xenon-0.9.3-py2.py3-none-any.whl

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.1Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality AssuranceTopic :: Utilities

Tags

python code complexity monitoringcyclomatic complexity checkercode quality ci integrationcomplexity threshold enforcementradon-based code metricsbuild failure on complexitypre-commit complexity hook
code-qualityci-integrationcomplexity-analysis

More Software Development packages