{"id":6813,"library":"pyroma","title":"Pyroma","description":"Pyroma is a Python library and command-line tool designed to test your project's packaging friendliness. It evaluates a Python project's metadata, structure, and configuration (e.g., `setup.py`, `pyproject.toml`) against a set of best practices to determine how well-prepared it is for distribution on PyPI. The current version is 5.0.1, with major releases occurring roughly annually and minor updates as needed.","status":"active","version":"5.0.1","language":"en","source_language":"en","source_url":"https://github.com/regebro/pyroma","tags":["packaging","linting","pypi","quality-assurance","distribution"],"install":[{"cmd":"pip install pyroma","lang":"bash","label":"Install Pyroma"}],"dependencies":[],"imports":[{"note":"In Pyroma v5.0.0, the `run_pyroma` function was moved from the top-level `pyroma` module to `pyroma.ratings.run_pyroma`. Direct import from `pyroma` will raise an `AttributeError`.","wrong":"import pyroma; pyroma.run_pyroma(...)","symbol":"run_pyroma","correct":"from pyroma import ratings; ratings.run_pyroma"}],"quickstart":{"code":"import os\nimport shutil\nfrom pathlib import Path\nfrom pyroma import ratings\n\n# Create a dummy project directory for testing\nproject_root = Path(\"temp_pyroma_project\")\nproject_root.mkdir(exist_ok=True)\n\n# Create a minimal setup.py, README.md, and __init__.py\n(project_root / \"setup.py\").write_text(\n    \"from setuptools import setup; setup(name='dummy', version='0.1.0', description='A dummy project for pyroma test', packages=['dummy_pkg'])\"\n)\n(project_root / \"README.md\").write_text(\"# Dummy Project\\n\\nThis is a temporary project for pyroma testing.\")\n(project_root / \"dummy_pkg\").mkdir(exist_ok=True)\n(project_root / \"dummy_pkg\" / \"__init__.py\").touch() \n\n# Run pyroma on the dummy project\nprint(f\"Running pyroma on: {project_root.resolve()}\")\nscore, messages = ratings.run_pyroma(project_root)\n\nprint(f\"\\nPyroma Score: {score}/10\")\nprint(\"Messages:\")\nif messages:\n    for message in messages:\n        print(f\"- {message}\")\nelse:\n    print(\"No messages (perfect score).\")\n\n# Clean up the dummy project\nif project_root.exists():\n    shutil.rmtree(project_root)\n    print(f\"\\nCleaned up {project_root}\")","lang":"python","description":"This quickstart demonstrates how to programmatically use Pyroma. It creates a temporary, minimal Python project directory, runs `pyroma.ratings.run_pyroma` on it, prints the score and any messages, and then cleans up the temporary files. This pattern is useful for integrating Pyroma checks into custom scripts or CI/CD pipelines."},"warnings":[{"fix":"Update your code to pass the project's root directory: `pyroma.ratings.run_pyroma('/path/to/project_root')`. For the CLI, use `pyroma /path/to/project_root` or simply `pyroma .` from within the project's root.","message":"In Pyroma v5.0.0, the programmatic API (`run_pyroma`) and the command-line interface (CLI) shifted to operate on a *directory path* rather than directly on a `setup.py` file. Calls explicitly passing a `setup.py` file path will no longer work.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Ensure your environment uses Python 3.9 or newer. If you must use an older Python version, pin Pyroma to a compatible version, e.g., `pyroma<5.0.0`.","message":"Pyroma v5.0.0 raised the minimum required Python version to 3.9. Projects attempting to use Pyroma on older Python runtimes will encounter an `ImportError` or installation failure.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Understand Pyroma's scope as a packaging linter. Focus on addressing specific warnings related to `setup.py`, `pyproject.toml`, `README`, and package structure to improve its distribution readiness, rather than expecting it to validate application logic.","message":"Pyroma assesses a project's 'packaging friendliness' based on its metadata and structure, not the functional correctness or code quality of the Python application itself. A project can be fully functional but receive a low Pyroma score if its packaging configuration is non-standard or incomplete.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always execute `pyroma .` from your project's root directory, or provide the full path to the root: `pyroma /path/to/my/project`.","message":"When using Pyroma via the CLI, ensure you are in the project's root directory or explicitly specify the project's root. If run without arguments from a non-project directory, it will attempt to analyze the current directory and might report 'No setup.py or pyproject.toml found' errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}