Skip to content
/ pyaud Public

The pyaud framework is designed for writing modular audits for Python packages

License

Notifications You must be signed in to change notification settings

jshwi/pyaud

Repository files navigation

pyaud

License PyPI Build CodeQL pre-commit.ci status codecov.io readthedocs.org python3.8 Black isort docformatter pylint Security Status Known Vulnerabilities pyaud

Framework for writing Python package audits

The pyaud framework is designed for writing modular audits for Python packages

Audits can be run to fail, such as when using CI, or include a fix

Fixes can be written for whole directories or individual files

Plugins can be written for manipulating files

Supports single script plugins

Installation

$ pip install pyaud

Usage

Commandline

usage: pyaud [-h] [-v] [-f] [-n] [-s] [--audit LIST] [--exclude EXCLUDE] MODULE

positional arguments:
  MODULE             choice of module: [modules] to list all

optional arguments:
  -h, --help         show this help message and exit
  -v, --version      show program's version number and exit
  -f, --fix          suppress and fix all fixable issues
  -n, --no-cache     disable file caching
  -s, --suppress     continue without stopping for errors
  --audit LIST       comma separated list of plugins for audit
  --exclude EXCLUDE  regex of paths to ignore

Plugins

pyaud will search for a plugins package in the project root

To register a plugin package ensure it is importable and prefix the package with pyaud_

The name pyaud_plugins is reserved and will be automatically imported

To view available plugins see pyaud-plugins README or run pyaud modules all

For writing plugins see docs

Configure

Configuration values are declared in the pyproject.toml file

[tool.pyaud]
audit = [
  "commit-policy",
  "const",
  "docs",
  "files",
  "format",
  "format-docs",
  "format-str",
  "imports",
  "lint",
  "params",
  "test",
  "typecheck",
  "unused"
]
exclude = '''
  (?x)^(
    | docs\/conf\.py
    | whitelist\.py
  )$
'''