Package: wily
A command-line application for tracking, reporting on complexity of Python tests and applications.wily [a]:
quick to think of things, having a very good understanding of situations and possibilities, 
and often willing to use tricks to achieve an aim.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.InstallationWily can be installed via pip from Python 3.6 and above:$pipinstallwilyAlternatively, Wily packages are available on conda-forge:$condainstall-cconda-forgewilyUsageSee theDocumentation Sitefor full usage guides.Wily can be used via a command line interface,wily.$wily--helpDemoHere 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:Using Wily in a CI/CD pipelineWily can be used in a CI/CD workflow to compare the complexity of the current files against a particular revision.By default, wily will compare against the previous revision (for a git-pre-commit hook) but you can also give a Git ref, for exampleHEAD^1is the commit before the HEAD reference.$wilybuildsrc/$wilydiffsrc/-rHEAD^1Or, to compare against$wilybuildsrc/$wilydiffsrc/-rmasterpre-commit pluginYou can install wily as apre-commitplugin by adding the following to.pre-commit-config.yamlrepos:-repo:localhooks:-id:wilyname:wilyentry:wily diffverbose:truelanguage:pythonadditional_dependencies:[wily]Command line usagewily buildThe first step to usingwilyis to build a wily cache with the statistics of your project.Usage: __main__.py build [OPTIONS] [TARGETS]...

  Build the wily cache

Options:
  -n, --max-revisions INTEGER  The maximum number of historical commits to
                               archive
  -o, --operators TEXT         List of operators, separated by commas
  --help                       Show this message and exit.By default, wily will assume your project folder is agitdirectory. Wily will not build a cache if the working copy is dirty (has changed files not committed).$wilybuildsrc/Limit the number of revisions (defaults to 50).wily reportShow a specific metric for a given file, requires that.wily/existswily reportwill print the metric and the delta between each revision.wily rankShow the ranking for all files in a directory or a single file based on the metric provided, requires that.wily/existswily rankwill print a table of files and their metric values.wily graphSimilar towily reportbut instead of printing in the console,wilywill print a graph in a browser.wily indexShow information about the build directory. Requires that.wily/exists.wily indexwill print the configuration to the screen and list all revisions that have been analysed and the operators used.wily list-metricsList the metrics available in the Wily operators. Each one of the metrics can be used inwily graphandwily report$wilylist-metricsmccabe operator:No metrics availableraw operator:╒═════════════════╤══════════════════════╤═══════════════╤══════════════════════════╕│                 │ Name                 │ Description   │ Type                     │╞═════════════════╪══════════════════════╪═══════════════╪══════════════════════════╡│ loc             │ Lines of Code        │ <class 'int'> │ MetricType.Informational │├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤│ lloc            │ L Lines of Code      │ <class 'int'> │ MetricType.Informational │├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤│ sloc            │ S Lines of Code      │ <class 'int'> │ MetricType.Informational │├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤│ comments        │ Multi-line comments  │ <class 'int'> │ MetricType.Informational │├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤│ multi           │ Multi lines          │ <class 'int'> │ MetricType.Informational │├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤│ blank           │ blank lines          │ <class 'int'> │ MetricType.Informational │├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤│ single_comments │ Single comment lines │ <class 'int'> │ MetricType.Informational │╘═════════════════╧══════════════════════╧═══════════════╧══════════════════════════╛cyclomatic operator:No metrics availablemaintainability operator:╒══════╤═════════════════════════╤═════════════════╤══════════════════════════╕│      │ Name                    │ Description     │ Type                     │╞══════╪═════════════════════════╪═════════════════╪══════════════════════════╡│ rank │ Maintainability Ranking │ <class 'str'>   │ MetricType.Informational │├──────┼─────────────────────────┼─────────────────┼──────────────────────────┤│ mi   │ Maintainability Index   │ <class 'float'> │ MetricType.AimLow        │╘══════╧═════════════════════════╧═════════════════╧══════════════════════════╛ConfigurationYou can put awily.cfgfile in your project directory andwilywill override the runtime settings. Here are the available options:[wily]# list of operators, choose from cyclomatic, maintainability, mccabe and rawoperators=cyclomatic,raw# archiver to use, defaults to gitarchiver=git# path to analyse, defaults to .path=/path/to/target# max revisions to archive, defaults to 50max_revisions=20You can also override the path to the configuration with the--configflag on the command-line.IPython/Jupyter NotebooksWily will detect and scan all Python code in .ipynb files automatically.You can disable this behaviour if you require by settingipynb_support = falsein the configuration.
You can also disable the behaviour of reporting on individual cells by settingipynb_cells = false.CreditsContributors@wcooley (Wil Cooley)@DahlitzFlorian (Florian Dahlitz)@alegonz@DanielChabrowski@jwattier@skarzi"cute animal doing dabbing"Designed by Freepik