Pyroma

5.0.1 · active · verified Wed Apr 15

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.

Warnings

Install

Imports

Quickstart

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.

import os
import shutil
from pathlib import Path
from pyroma import ratings

# Create a dummy project directory for testing
project_root = Path("temp_pyroma_project")
project_root.mkdir(exist_ok=True)

# Create a minimal setup.py, README.md, and __init__.py
(project_root / "setup.py").write_text(
    "from setuptools import setup; setup(name='dummy', version='0.1.0', description='A dummy project for pyroma test', packages=['dummy_pkg'])"
)
(project_root / "README.md").write_text("# Dummy Project\n\nThis is a temporary project for pyroma testing.")
(project_root / "dummy_pkg").mkdir(exist_ok=True)
(project_root / "dummy_pkg" / "__init__.py").touch() 

# Run pyroma on the dummy project
print(f"Running pyroma on: {project_root.resolve()}")
score, messages = ratings.run_pyroma(project_root)

print(f"\nPyroma Score: {score}/10")
print("Messages:")
if messages:
    for message in messages:
        print(f"- {message}")
else:
    print("No messages (perfect score).")

# Clean up the dummy project
if project_root.exists():
    shutil.rmtree(project_root)
    print(f"\nCleaned up {project_root}")

view raw JSON →