Wily is an application for tracking the complexity of Python code in tests and applications.

Documentation Status https://badge.fury.io/py/wily.svg

Wily uses git to go through each revision (commit) in a branch and run complexity and code-analysis metrics over the code. You can use this to limit your code or report on trends for complexity, length etc.

What is wily?

Wily is a command-line tool for archiving, exploring and graphing the complexity of Python source code.

Wily supports iterating over a git repository and indexing the complexity of the Python source files using a number of algorithms. You can then report on those in the console or graph them to a browser.

Getting Started

You can install wily from PyPi using pip

$ pip install wily

Or, if you prefer to use conda

$ conda install -c conda-forge wily

Wily needs an index of the project before any of the commands can be used. Build Command builds an index in a Git repository. Provide the path to your source code as the first argument.

$ wily build src/

You can provide multiple source directories, such as your test projects.

$ wily build src/ test/

See Build Command for more details on the build command.

Now that you have an index, you can run wily report or wily graph to see the data.


You can display any of the metrics in a HTML graph by running the graph command with the path to the file and the metric

$ wily graph wily/__main__.py loc

See Report Command and Graph Command for more details on the report and graph commands.

To get a list of available metrics, run:

$ wily list-metrics

Pre-commit hook

You can install wily as a pre-commit plugin.

-   repo: local
    -   id: wily
        name: wily
        entry: wily diff
        verbose: true
        language: python
        additional_dependencies: [wily]

“cute animal doing dabbing” Designed by Freepik