A Rust-based multi-language CLI that runs linters, auto-formatters, security scanners and maintainability checks through one tool and config file.
tonybaloney/wily
A command-line tool that walks git history and tracks how complexity and code metrics of Python code change over time.
- Stars
- 1,336
- Forks
- 73
- Open issues
- 43
- Last commit
- 10 days ago
What is it?
Wily is a command-line application for measuring Python code over time. It uses git to step through each revision in a branch and runs complexity and code-analysis metrics on the files at every commit, storing the results in a local cache under a .wily/ directory.
With that cache, you can report how a metric such as cyclomatic complexity, maintainability index, Halstead measures or lines of code changed between revisions, rank files by a metric, or open a graph of the trend in a browser. The diff command compares the current files against a chosen git ref, which makes it usable as a pre-commit hook or a CI check.
Metrics are grouped into operators (cyclomatic, cognitive, maintainability, halstead and raw), configurable through a wily.cfg file. Jupyter notebooks are scanned by default, with an option to report per cell.
Key features
- 01Builds a metric cache by walking git commits in a branch.
- 02Reports metric deltas between revisions with wily report.
- 03Ranks files in a directory by a chosen metric.
- 04Plots metric trends in a browser with wily graph.
- 05Compares current code against any git ref using wily diff.
- 06Scans Python code inside .ipynb notebooks, optionally per cell.
Use cases
- Tracking whether a Python codebase is getting more complex over its commit history.
- Failing a CI or pre-commit check when a change increases complexity against a previous revision.
- Finding the most complex files in a project to prioritize refactoring.
- Monitoring code quality trends in data science projects built on Jupyter notebooks.
Quick start
- 1
Install wily from PyPI with pip
pip install wily - 2
Build the wily cache for your source folder inside a git repo
wily build src/ - 3
Report changes in complexity for the analysed files
wily report src/
Things to know
- Analyses Python code only.
- Requires a git repository to track history, and the working copy must be clean to build the cache.
In collections
Topics
FAQ
- What is wily?
- A command-line tool that walks git history and tracks how complexity and code metrics of Python code change over time. Wily is a command-line application for measuring Python code over time. It uses git to step through each revision in a branch and runs complexity and code-analysis metrics on the files at every commit, storing the results in a local cache under a .wily/ directory.
- Is wily free to use? What license does it have?
- wily is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is wily still maintained?
- Actively maintained. The last commit to wily was on Oct 28, 2026.
- What can I use wily for?
- Tracking whether a Python codebase is getting more complex over its commit history. Failing a CI or pre-commit check when a change increases complexity against a previous revision. Finding the most complex files in a project to prioritize refactoring. Monitoring code quality trends in data science projects built on Jupyter notebooks.
- How do I install wily?
- Install wily from PyPI with pip: pip install wily Build the wily cache for your source folder inside a git repo: wily build src/ Report changes in complexity for the analysed files: wily report src/
- Where can I get wily?
- The source code and installation instructions are on GitHub: https://github.com/tonybaloney/wily
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Python tool that computes McCabe cyclomatic complexity for functions and runs as a flake8 plugin to flag overly complex code.
A static code analyser for Python that checks for errors, enforces coding standards, and flags code smells without running your code.
A strict, opinionated flake8 plugin that enforces consistent, simple Python code style and flags complex code patterns.
A Python linter that checks source files for errors by parsing code without importing it, avoiding style checks.
A linter that enforces Swift style and conventions, with over 200 rules that can be configured per project.