PyPI Simple Repository API Client

1.8.0 · active · verified Thu Apr 16

pypi-simple is a client library for the Python Simple Repository API, as specified in PEP 503 and updated by various other PEPs (592, 629, 658, 691, 700, 708, 714, 740, 792). It allows users to query PyPI and other pip-compatible repositories for available projects and their package files, download packages, and inspect their metadata. The current version is 1.8.0. While no explicit release cadence is stated, the project maintains regular updates, with version 1.8.0 released on September 3, 2025.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to fetch details for a specific project like 'requests' using `PyPISimple.get_project_page()`. It also includes a commented-out example for streaming all project names using `stream_project_names()`, with a caution about the size of PyPI's index.

from pypi_simple import PyPISimple

# Example 1: Get information about a package
with PyPISimple() as client:
    requests_page = client.get_project_page('requests')
    if requests_page and requests_page.packages:
        pkg = requests_page.packages[0]
        print(f"Latest 'requests' package: {pkg.filename} (version {pkg.version})")
        print(f"Download URL: {pkg.url}")

# Example 2: List all project names (caution: this can be slow and large)
# try:
#     with PyPISimple() as client:
#         # PyPI's top-level simple HTML page is cached for 24 hours.
#         # Use stream_project_names() for potentially faster, memory-efficient retrieval.
#         all_projects = list(client.stream_project_names())
#         print(f"Found {len(all_projects)} projects.")
# except Exception as e:
#     print(f"Error listing projects: {e}")

view raw JSON →