Python packaging quality assessment tool that evaluates how well Python projects comply with best practices of the Python packaging ecosystem.
—
Main functions for running pyroma analysis programmatically and from the command line. These functions provide the primary interface for integrating pyroma into development workflows, automation scripts, and continuous integration pipelines.
main()
def main():
"""Command-line interface entry point for pyroma.
Handles argument parsing and executes package analysis based on
provided arguments. Exits with code 0 for successful analysis
above minimum rating, code 2 for ratings below minimum.
"""Command-line interface that parses arguments and executes analysis:
--skip-testsrun(mode, argument, quiet=False, skip_tests=None)
def run(mode, argument, quiet=False, skip_tests=None):
"""Run pyroma analysis on a package.
Args:
mode: Analysis mode - "directory", "file", "pypi", or "auto"
argument: Package path, filename, or PyPI package name
quiet: If True, suppresses output except final rating
skip_tests: List of test class names to skip during analysis
Returns:
int: Package rating from 0-10
Raises:
ValueError: If package not found or invalid mode specified
"""The primary analysis function that:
Usage examples:
# Analyze local project directory
rating = run('directory', '/path/to/project')
# Analyze distribution file
rating = run('file', 'package-1.0.tar.gz')
# Analyze PyPI package
rating = run('pypi', 'requests')
# Skip specific tests
rating = run('directory', '.', skip_tests=['BusFactor', 'SDist'])
# Quiet mode for scripts
rating = run('directory', '.', quiet=True)zester(data)
def zester(data):
"""Integration hook for zest.releaser.
Prompts user to run pyroma analysis before package release.
If rating is below 8, asks for confirmation to continue.
Args:
data: Release data dictionary from zest.releaser
Exits:
System exit with code 1 if user chooses not to continue
after low rating
"""Pre-release hook for zest.releaser that:
get_all_tests()
def get_all_tests():
"""Get list of all available test class names.
Returns:
list: List of test class names that can be used with skip_tests
Example:
['Name', 'Version', 'Description', 'Classifiers', ...]
"""parse_tests(arg)
def parse_tests(arg):
"""Parse test names from string with various separators.
Args:
arg: Test names separated by spaces, commas, or semicolons
Returns:
str or None: Parsed test name if valid, None if invalid
"""skip_tests(arg)
def skip_tests(arg):
"""Argument parser type function for validating skip_tests.
Args:
arg: Comma/space/semicolon-separated test names
Returns:
str: Validated test name
Raises:
ArgumentTypeError: If test name is not valid
"""min_argument(arg)
def min_argument(arg):
"""Argument parser type function for minimum rating validation.
Args:
arg: Rating value as string (must be 1-10)
Returns:
int: Validated rating value
Raises:
ArgumentTypeError: If rating is not between 1-10
"""Install with Tessl CLI
npx tessl i tessl/pypi-pyroma