{"id":13419373,"url":"https://github.com/tonybaloney/wily","last_synced_at":"2025-04-10T04:52:47.403Z","repository":{"id":37431080,"uuid":"152661983","full_name":"tonybaloney/wily","owner":"tonybaloney","description":"A Python application for tracking, reporting on timing and complexity in Python code","archived":false,"fork":false,"pushed_at":"2024-07-10T07:19:19.000Z","size":5851,"stargazers_count":1229,"open_issues_count":45,"forks_count":61,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-03T02:48:44.662Z","etag":null,"topics":["complexity","hacktoberfest","hacktoberfest-accepted","python","quality"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tonybaloney.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tonybaloney"]}},"created_at":"2018-10-11T22:12:25.000Z","updated_at":"2025-04-02T16:29:01.000Z","dependencies_parsed_at":"2023-11-08T05:52:45.476Z","dependency_job_id":"eed9101b-3e4e-4f5e-9f60-91710846205d","html_url":"https://github.com/tonybaloney/wily","commit_stats":{"total_commits":769,"total_committers":26,"mean_commits":"29.576923076923077","dds":0.5916775032509753,"last_synced_commit":"2590691d5d29a2872cc175bdb773b1dbf5fde202"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonybaloney%2Fwily","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonybaloney%2Fwily/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonybaloney%2Fwily/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonybaloney%2Fwily/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tonybaloney","download_url":"https://codeload.github.com/tonybaloney/wily/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161262,"owners_count":21057553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["complexity","hacktoberfest","hacktoberfest-accepted","python","quality"],"created_at":"2024-07-30T22:01:15.038Z","updated_at":"2025-04-10T04:52:47.380Z","avatar_url":"https://github.com/tonybaloney.png","language":"Python","funding_links":["https://github.com/sponsors/tonybaloney"],"categories":["Python","Debugging \u0026 Profiling \u0026 Tracing","Programming Languages","Code Metrics \u0026 Complexity"],"sub_categories":["For Python"],"readme":"![wily](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/logo.png)\n\nA command-line application for tracking, reporting on complexity of Python tests and applications.\n\n[![Wily](https://img.shields.io/badge/%F0%9F%A6%8A%20wily-passing-brightgreen.svg)](https://wily.readthedocs.io/)\n[![codecov](https://codecov.io/gh/tonybaloney/wily/branch/master/graph/badge.svg)](https://codecov.io/gh/tonybaloney/wily) [![Documentation Status](https://readthedocs.org/projects/wily/badge/?version=latest)](https://wily.readthedocs.io/en/latest/?badge=latest) [![PyPI version](https://badge.fury.io/py/wily.svg)](https://badge.fury.io/py/wily) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/wily.svg)](https://anaconda.org/conda-forge/wily) ![black](https://img.shields.io/badge/code%20style-black-000000.svg) ![PyPI - Downloads](https://img.shields.io/pypi/dm/wily)\n\n```default\nwily [a]:\nquick to think of things, having a very good understanding of situations and possibilities, \nand often willing to use tricks to achieve an aim.\n```\n\nWily 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.\n\n## Installation\n\nWily can be installed via pip from Python 3.6 and above:\n\n```console\n $ pip install wily\n```\n\nAlternatively, Wily packages are available on conda-forge:\n\n```console\n $ conda install -c conda-forge wily\n```\n\n## Usage\n\nSee the [Documentation Site](https://wily.readthedocs.io/) for full usage guides.\n\nWily can be used via a command line interface, `wily`.\n\n```console\n $ wily --help\n```\n\n![help-screen](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/wily_help.png)\n\n## Demo\n\nHere is a demo of wily analysing a Python project, giving a summary of changes to complexity in the last 10 commits and then showing changes against a specific git revision:\n\n![demo](./docs/source/_static/termtosvg_leo0ur6s.svg)\n\n## Using Wily in a CI/CD pipeline\n\nWily can be used in a CI/CD workflow to compare the complexity of the current files against a particular revision.\n\nBy default, wily will compare against the previous revision (for a git-pre-commit hook) but you can also give a Git ref, for example `HEAD^1` is the commit before the HEAD reference.\n\n```console\n $ wily build src/\n $ wily diff src/ -r HEAD^1\n```\n\nOr, to compare against\n\n```console\n $ wily build src/\n $ wily diff src/ -r master\n```\n\n## pre-commit plugin\n\nYou can install wily as a [pre-commit](http://www.pre-commit.com/) plugin by adding the following to ``.pre-commit-config.yaml``\n\n```yaml\nrepos:\n-   repo: local\n    hooks:\n    -   id: wily\n        name: wily\n        entry: wily diff\n        verbose: true\n        language: python\n        additional_dependencies: [wily]\n```\n\n### Command line usage\n\n#### `wily build`\n\nThe first step to using `wily` is to build a wily cache with the statistics of your project. \n\n```default\nUsage: __main__.py build [OPTIONS] [TARGETS]...\n\n  Build the wily cache\n\nOptions:\n  -n, --max-revisions INTEGER  The maximum number of historical commits to\n                               archive\n  -o, --operators TEXT         List of operators, separated by commas\n  --help                       Show this message and exit.\n```\n\nBy default, wily will assume your project folder is a `git` directory. Wily will not build a cache if the working copy is dirty (has changed files not committed).\n\n```console\n $ wily build src/\n ```\n\nLimit the number of revisions (defaults to 50).\n\n![wily-build](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/wily_build.png)\n\n#### `wily report`\n\nShow a specific metric for a given file, requires that `.wily/` exists\n\n`wily report` will print the metric and the delta between each revision.\n\n![wily-report](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/wily_report.png)\n\n#### `wily rank`\n\nShow the ranking for all files in a directory or a single file based on the metric provided, requires that `.wily/` exists\n\n`wily rank` will print a table of files and their metric values.\n\n![wily-rank](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/wily_rank.png)\n\n#### `wily graph`\n\nSimilar to `wily report` but instead of printing in the console, `wily` will print a graph in a browser.\n\n![wily-graph](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/single_metric_graph.png)\n\n#### `wily index`\n\nShow information about the build directory. Requires that `.wily/` exists.\n\n`wily index` will print the configuration to the screen and list all revisions that have been analysed and the operators used.\n\n![wily-graph](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/wily_index.png)\n\n### `wily list-metrics`\n\nList the metrics available in the Wily operators. Each one of the metrics can be used in `wily graph` and `wily report`\n\n```console\n $ wily list-metrics\nmccabe operator:\nNo metrics available\nraw operator:\n╒═════════════════╤══════════════════════╤═══════════════╤══════════════════════════╕\n│                 │ Name                 │ Description   │ Type                     │\n╞═════════════════╪══════════════════════╪═══════════════╪══════════════════════════╡\n│ loc             │ Lines of Code        │ \u003cclass 'int'\u003e │ MetricType.Informational │\n├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤\n│ lloc            │ L Lines of Code      │ \u003cclass 'int'\u003e │ MetricType.Informational │\n├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤\n│ sloc            │ S Lines of Code      │ \u003cclass 'int'\u003e │ MetricType.Informational │\n├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤\n│ comments        │ Multi-line comments  │ \u003cclass 'int'\u003e │ MetricType.Informational │\n├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤\n│ multi           │ Multi lines          │ \u003cclass 'int'\u003e │ MetricType.Informational │\n├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤\n│ blank           │ blank lines          │ \u003cclass 'int'\u003e │ MetricType.Informational │\n├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤\n│ single_comments │ Single comment lines │ \u003cclass 'int'\u003e │ MetricType.Informational │\n╘═════════════════╧══════════════════════╧═══════════════╧══════════════════════════╛\ncyclomatic operator:\nNo metrics available\nmaintainability operator:\n╒══════╤═════════════════════════╤═════════════════╤══════════════════════════╕\n│      │ Name                    │ Description     │ Type                     │\n╞══════╪═════════════════════════╪═════════════════╪══════════════════════════╡\n│ rank │ Maintainability Ranking │ \u003cclass 'str'\u003e   │ MetricType.Informational │\n├──────┼─────────────────────────┼─────────────────┼──────────────────────────┤\n│ mi   │ Maintainability Index   │ \u003cclass 'float'\u003e │ MetricType.AimLow        │\n╘══════╧═════════════════════════╧═════════════════╧══════════════════════════╛\n```\n\n## Configuration\n\nYou can put a `wily.cfg` file in your project directory and `wily` will override the runtime settings. Here are the available options:\n\n```ini\n[wily]\n# list of operators, choose from cyclomatic, maintainability, mccabe and raw\noperators = cyclomatic,raw\n# archiver to use, defaults to git\narchiver = git\n# path to analyse, defaults to .\npath = /path/to/target\n# max revisions to archive, defaults to 50\nmax_revisions = 20\n```\n\nYou can also override the path to the configuration with the `--config` flag on the command-line.\n\n## IPython/Jupyter Notebooks\n\nWily will detect and scan all Python code in .ipynb files automatically. \n\nYou can disable this behaviour if you require by setting `ipynb_support = false` in the configuration.\nYou can also disable the behaviour of reporting on individual cells by setting `ipynb_cells = false`.\n\n# Credits\n\n## Contributors\n\n- @wcooley (Wil Cooley)\n- @DahlitzFlorian (Florian Dahlitz)\n- @alegonz\n- @DanielChabrowski\n- @jwattier\n- @skarzi\n\n\"cute animal doing dabbing\" [Designed by Freepik](https://www.freepik.com/free-vector/cute-animal-doing-dabbing_2462508.htm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonybaloney%2Fwily","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftonybaloney%2Fwily","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonybaloney%2Fwily/lists"}