skillfed

radon

Code Metrics in Python

radon v6.0.1 5.8M downloads/30d#2,038 on PyPI2,005
Permissive license MIT DORMANT released

What it is and what it does

Radon is a static analysis tool that measures code quality through multiple metrics. It computes cyclomatic complexity (how many independent paths flow through code), raw metrics like lines of code and comment density, Halstead metrics (effort and difficulty estimates), and a maintainability index similar to Visual Studio's implementation. You run it from the command line or call it programmatically to analyze Python files and get a report on code structure and complexity.

The tool is designed to integrate into CI/CD pipelines and code review platforms (Codacy, Code Climate, coala, CodeFactor all support it). It depends only on mando for CLI handling and colorama for optional colored output. It can also analyze Jupyter notebooks if the optional nbformat package is installed.

Use it for:

  • Identify overly complex functions that need refactoring by running cyclomatic complexity analysis on a codebase
  • Measure code maintainability trends over time by tracking raw metrics and maintainability index across releases
  • Integrate code quality gates into CI/CD by using radon to fail builds when complexity thresholds are exceeded
  • Analyze Jupyter notebooks for code quality metrics alongside regular Python files
  • Generate code quality reports for code review or documentation purposes

Worth the install?

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

Radon computes code metrics from Python source files, including cyclomatic complexity, raw metrics (lines of code, comments, blanks), Halstead metrics, and maintainability index.

Yes, with conditions. Radon is stable and widely used (5.7M monthly downloads, top 5000 packages), with no known vulnerabilities and low install friction. However, the project is dormant—no releases in over a year and no commits since October 2024. Install it if you need code metrics for analysis or CI integration, but do not expect active maintenance or support for very recent Python versions. For active monitoring and CI enforcement, consider xenon as an alternative.

Install

radon on PyPI

pip

pip install radon

uv

uv add radon

poetry

poetry add radon

Installing radon

Before you install

Low install friction with only two runtime dependencies (mando and colorama). Dormant maintenance status—last release was over a year ago and no commits since October 2024—but the package is marked Production/Stable and has accumulated 2005 repository stars.

License in practice

MIT license is permissive, allowing commercial and private use with minimal restrictions.

Quickstart

pip install radon

radon cc mymodule.py -a

# Or programmatically:
from radon.complexity import cc_visit
with open('mymodule.py') as f:
    results = cc_visit(f.read())

On Windows or systems with non-UTF-8 default encoding, set the RADONFILESENCODING environment variable to UTF-8 to analyze files with Unicode characters.

Verify before relying

  • Whether the package remains actively maintained or is effectively unmaintained despite Production/Stable status
  • Compatibility with Python versions beyond 3.8 (classifiers list up to 3.9 but description mentions 3.8 as the upper bound)

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — mando, colorama
Maintenance dormant — 1,237 days since the last release
Last repo commit
First released
Downloads 5,780,891/month — #2,038 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: radon-6.0.1-py2.py3-none-any.whl

Keywords: static, analysis, code, complexity, metrics

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality AssuranceTopic :: Utilities

Tags

cyclomatic complexity analysiscode metrics pythonmaintainability indexsource code analysishalstead metricscode quality metricsstatic code analysis
code-metricsstatic-analysisci-integration

More Software Development packages