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 fixFixes can be written for whole directories or individual filesPlugins can be written for manipulating filesSupports single script plugins
Install
Dependencies
python3.8 (see pyenv)pip
PyPi
pip install pyaud
Development
poetry install
Usage
usage: pyaud [-h] [-c] [-d] [-f] [-s] [-v] [--rcfile RCFILE] MODULE
positional arguments:
MODULE choice of module: [modules] to list all
optional arguments:
-h, --help show this help message and exit
-c, --clean clean unversioned files prior to any process
-d, --deploy include test and docs deployment after audit
-s, --suppress continue without stopping for errors
-v, --verbose incrementally increase logging verbosity
--rcfile RCFILE select file to override config hierarchy
Plugins
pyaud will search for a plugins package in the project root
This package can contain any number of Python modulesFor writing plugins see docs
The following plugins are usable out of the box:
audit -- Read from [audit] key in config
clean -- Remove all unversioned package files recursively
coverage -- Run package unit-tests with `pytest` and `coverage`
deploy -- Deploy package documentation and test coverage
deploy-cov -- Upload coverage data to `Codecov`
deploy-docs -- Deploy package documentation to `gh-pages`
docs -- Compile package documentation with `Sphinx`
files -- Audit project data files
format -- Audit code against `Black`
format-docs -- Format docstrings with `docformatter`
format-str -- Format f-strings with `flynt`
generate-rcfile -- Print rcfile to stdout
imports -- Audit imports with `isort`
lint -- Lint code with `pylint`
readme -- Parse, test, and assert RST code-blocks
requirements -- Audit requirements.txt with Pipfile.lock
tests -- Run the package unit-tests with `pytest`
toc -- Audit docs/<NAME>.rst toc-file
typecheck -- Typecheck code with `mypy`
unused -- Audit unused code with `vulture`
whitelist -- Check whitelist.py file with `vulture`
Environment
Default environment variables:
PYAUD_WHITELIST = "whitelist.py"
PYAUD_COVERAGE_XML = "coverage.xml"
PYAUD_REQUIREMENTS = "requirements.txt"
PYAUD_GH_NAME = ""
PYAUD_GH_EMAIL = ""
PYAUD_GH_TOKEN = ""
PYAUD_GH_REMOTE = ""
Environment variables should be placed in an .env file in the project root and override all config files
Configure
Configuration of settings can be made with the following toml syntax files (overriding in this order):
~/.config/pyaud/pyaud.toml~/.pyaudrc.pyaudrcpyproject.toml
Example config:
[clean]
exclude = ["*.egg*", ".mypy_cache", ".env", "instance"]
[logging]
version = 1
disable_existing_loggers = true
[indexing]
exclude = ["whitelist.py", "conf.py", "setup.py"]
[packages]
exclude = ["tests"]
name = "pyaud"
[audit]
modules = [
"format",
"format-docs",
"format-str",
"imports",
"typecheck",
"unused",
"lint",
"coverage",
"readme",
"docs",
]
[logging.root]
level = "INFO"
handlers = ["default"]
propagate = false
[logging.formatters.standard]
format = "%(asctime)s %(levelname)s %(name)s %(message)s"
[logging.handlers.default]
class = "logging.handlers.TimedRotatingFileHandler"
formatter = "standard"
when = "d"
backupCount = 60
filename = "~/.cache/pyaud/log/pyaud.log"
Prefix each key with tool.pyaud when using pyproject.toml
[tool.pyaud.clean]
exclude = ["*.egg*", ".mypy_cache", ".env", "instance"]
Metadata
Release files for pyaud 3.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyaud-3.8.0.tar.gz | 31.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyaud-3.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.0 kB
Release files / pyaud-3.8.0.tar.gz
| Download URL | pyaud-3.8.0.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
199cc9fba6757008f5be8f538add8000c8fff0d57c1836fc210873b8265cd724
|
|
BLAKE2b-256 checksum How to use checksums |
3ca6a5814c665ec21e219ffcf0dff42001acdc87cd02172c293b6b793f832db1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.11+ Linux/5.15.11-200.fc35.x86_64
|
Release files / pyaud-3.8.0-py3-none-any.whl
| Download URL | pyaud-3.8.0-py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
252125bf03d5d0570f0269e892b925c97898ee3e5de9299a26084f62cbcbaf16
|
|
BLAKE2b-256 checksum How to use checksums |
d9ad286f839e8089e6e14d87a1cef4e074d52d1e7219248cb642a47a0008050a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.11+ Linux/5.15.11-200.fc35.x86_64
|