CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyroma

Python packaging quality assessment tool that evaluates how well Python projects comply with best practices of the Python packaging ecosystem.

Pending
Overview
Eval results
Files

core-analysis.mddocs/

Core Analysis Functions

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.

Capabilities

Main Entry Point

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:

  • Supports multiple analysis modes (auto, directory, file, pypi)
  • Configurable minimum rating threshold (1-10, default 8)
  • Optional test skipping with --skip-tests
  • Quiet mode for CI/CD integration
  • Auto-detection of analysis mode based on argument type

Core Analysis Function

run(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:

  • Extracts package metadata using appropriate data extractor
  • Runs comprehensive quality assessment using rating system
  • Provides detailed feedback on packaging issues
  • Returns numerical rating for programmatic use

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)

Integration Functions

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:

  • Automatically runs pyroma on package before tagging
  • Prompts user for confirmation if rating is below 8
  • Integrates seamlessly with existing release workflows
  • Helps maintain packaging quality standards

Utility Functions

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

docs

core-analysis.md

data-extraction.md

index.md

rating-system.md

tile.json