PyPI Objects Reference

This module contains objects returned by pypiwrap.client.PyPIClient . They represent the data provided by the JSON API and the Stats API.

Warning

Some aspects of the documentation have been inferred from source code and issues of the Warehouse software powering PyPI. While this API seems to have remained stable, changes may occur.

class pypiwrap.objects.pypi.Ownership(roles: list[Role], organization: str | None = None)

Bases: APIObject

Information about the project’s roles and organization membership.

Added in version 2.1.0.

organization: str | None = None

The URL slug of the organization that owns this project, or none if the project is not owned by an organization.

roles: list[Role]

Roles representing the project’s owners and maintainers.

class pypiwrap.objects.pypi.Project(author: str | None, author_email: str | None, classifiers: list[str], description: str, description_content_type: str | None, dynamic: list[str], keywords: str | None, license: str | None, license_expression: str | None, license_files: list[str], maintainer: str | None, maintainer_email: str | None, name: str, platform: str | None, project_urls: dict[str, str], project_url: str, release_url: str, requires_dist: list[str], requires_python: str | None, provides_extra: list[str], summary: str, version: str, yanked: bool, yanked_reason: str | None, file_urls: list[~pypiwrap.objects.pypi.ReleaseFile], vulnerabilities: list[~pypiwrap.objects.pypi.Vulnerability], last_serial: int, ownership: ~pypiwrap.objects.pypi.Ownership = <factory>)

Bases: APIObject

A PyPI project or release.

This includes information about the project, this particular release, URLs to distribution files, and any reported vulnerabilities.

author: str | None

The author of this project.

author_email: str | None

The email or contact details of the project’s author.

classifiers: list[str]

A list of PyPI classifiers for this project.

See https://pypi.org/classifiers for a complete list of classifiers.

description: str

A description of the project.

description_content_type: str | None

The content type of the description if available.

PyPI supports 3 content types: text/plain, text/x-rst (reStructuredText), and text/markdown. PyPI will default to RST if no content type is specified or to plain text if the content type is invalid.

dynamic: list[str]

A list of distribution metadata values marked as Dynamic.

Dynamic values are values that are expected to be “filled in later” by build backends. See https://peps.python.org/pep-0643/ for details.

Added in version 2.0.0.

file_urls: list[ReleaseFile]

A list of files for this release.

keywords: str | None

Keywords relating to this project.

This value is usually a list of comma or space separated values. It is equivalent to the ‘Keywords’ field in the Core metadata spec.

last_serial: int

The most recent serial ID number for this project.

license: str | None

Text indicating the license for this project.

license_expression: str | None

If present, a valid SPDX license expression.

Added in version 2.0.0.

license_files: list[str]

A list of license files attached to this project, if any.

Added in version 2.0.0.

maintainer: str | None

The project’s maintainer.

maintainer_email: str | None

The email or contact details of the project’s maintainer.

name: str

The name of the project.

ownership: Ownership

Information about the project’s roles and organization membership.

Added in version 2.1.0.

platform: str | None

The platform target of this release, if any.

Usually, this is only set for platforms not included in the PyPI classifiers.

project_url: str

The PyPI URL for this project.

project_urls: dict[str, str]

A mapping of labels to URLs relating to this project.

provides_extra: list[str]

A list of optional or extra features provided by this package.

See https://peps.python.org/pep-0566/ for details. Distribution extra names should be valid Python identifiers as defined in https://peps.python.org/pep-0685/.

Added in version 2.0.0.

release_url: str

The PyPI URL relating to this specific release.

requires_dist: list[str]

A list of required distributions or dependencies specified according to PEP 508.

requires_python: str | None

The Python version required for this release.

summary: str

A short summary of this project.

version: str

The version of this project.

vulnerabilities: list[Vulnerability]

A list of vulnerabilities for this release, if any.

yanked: bool

Whether this release was ‘yanked’ or removed from circulation.

yanked_reason: str | None

The reason this release was yanked if applicable.

class pypiwrap.objects.pypi.ReleaseFile(digests: dict[str, str], filename: str, package_type: str, python_version: str, requires_python: str, size: Size, upload_time: datetime, upload_time_tz: datetime, url: str, yanked: bool, yanked_reason: str | None)

Bases: APIObject

A file part of a PyPI release.

digests: dict[str, str]

A mapping of hash names to hex encoded digests corresponding to this release file.

Usually, the digests available are md5, sha256, and blake2b_256. The keys available should be members of hashlib.algorithms_guaranteed.

filename: str

The filename for this release file.

package_type: str

The package type of this file.

Package types are grouped into ‘sdist’ for source distributions and ‘bdist_*’ for built distributions.

As of PEP 527 and PEP 715, PyPI only accepts ‘sdist’ and ‘bdist_wheel’. Other bdist variants may still be returned for older packages but they are considered legacy and can no longer be uploaded to PyPI.

python_version: str

The Python version target for this file.

This value is ‘source’ for source distributions and a version target following PEP 425 for built distributions.

requires_python: str

The Python version constraints for this file.

This is equivalent to the ‘Requires-Python’ key in the Core metadata specification.

size: Size

The size of this release file.

upload_time: datetime

The time this file was uploaded on.

upload_time_tz: datetime

The time this file was uploaded on in a format compliant with ISO 8601.

url: str

The URL for this release file.

yanked: bool

Whether this package was yanked.

yanked_reason: str | None

Why the package was yanked if applicable.

class pypiwrap.objects.pypi.Role(role: str, user: str)

Bases: APIObject

A role within an organization.

Added in version 2.1.0.

role: str

The name of the role assigned to the user. Either ‘Owner’ or ‘Maintainer’.

user: str

The username to which this role is assigned.

class pypiwrap.objects.pypi.Stats(total_size: Size, top_packages: dict[str, Size])

Bases: APIObject

Statistics about PyPI.

top_packages: dict[str, Size]

A mapping of top packages sorted by size.

total_size: Size

The total size of all packages on PyPI combined.

class pypiwrap.objects.pypi.Vulnerability(aliases: list[str], details: str, fixed_in: list[str], id: str, link: str, source: str, summary: str | None, withdrawn: datetime | None = None)

Bases: APIObject

A vulnerability in a PyPI project or release.

aliases: list[str]

The identifiers used to refer to this vulnerability.

details: str

Details about this vulnerability.

fixed_in: list[str]

A list of releases where this vulnerability was addressed.

id: str

An identifier for this vulnerability.

A URL where more information about this vulnerability is provided.

source: str

The source from where this vulnerability report was obtained.

summary: str | None

A short summary of this vulnerability if available.

withdrawn: datetime | None = None

The datetime this vulnerability was withdrawn if applicable.