Simple Repository Objects Reference

This module contains objects for the Simple Repository API (also known as the Index API). These objects are returned by pypiwrap.client.SimpleRepoClient.

Note that pypiwrap implements the JSON-based API specified in PEP 691 rather than the HTML-based API.

class pypiwrap.objects.simple_repo.DistributionFile(filename: str, url: str, size: Size, hashes: dict[str, str], upload_time: datetime | None = None, requires_python: str | None = None, core_metadata: bool | dict[str, str] | None = None, dist_info_metadata: bool | dict[str, str] | None = None, provenance_url: str | None = None, has_gpg_sig: bool | None = None, yanked: bool | str | None = None)

Bases: APIObject

A file representing a package distribution.

core_metadata: bool | dict[str, str] | None = None

An indication of whether metadata is available for this file.

  • If a boolean, whether this file has an associated metadata file.

  • If a dictionary, a mapping of hash names to hex encoded digests of the metadata file.

  • If None, this file has no associated metadata.

dist_info_metadata: bool | dict[str, str] | None = None

Contains the same values as DistributionFile.core_metadata.

When available, prefer using core_metadata over this attribute.

filename: str

The filename of this distribution.

property gpg_url: str | None

If available, a URL containing the GPG signature for this file.

has_gpg_sig: bool | None = None

Whether a GPG signature for this file exists. If none, this value is unknown.

For PyPI/Warehouse, this will always return None as GPG signatures are no longer supported by the service.

hashes: dict[str, str]

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

property metadata_url: str | None

If available, a URL containing the metadata file.

provenance_url: str | None = None

If available, a URL to the file’s associated provenance.

See https://peps.python.org/pep-0740/#provenance-objects for details.

Added in version 2.0.0.

requires_python: str | None = None

The version constraints for this file if specified.

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

size: Size

The size of the distribution.

upload_time: datetime | None = None

The upload time for this file.

url: str

The download URL for this file.

yanked: bool | str | None = None
  • If a boolean, whether the file was yanked.

  • If a non-empty string, why the package was yanked.

class pypiwrap.objects.simple_repo.IndexPage(meta: Meta, projects: list[str])

Bases: APIObject

The index page of the Simple Repository API.

Added in version 2.0.0.

meta: Meta

Information about the response.

projects: list[str]

A list of projects in the index.

class pypiwrap.objects.simple_repo.Meta(api_version: str, tracks: list[str])

Bases: APIObject

Information about a response from the Simple Repository API.

Added in version 2.0.0.

api_version: str

The API version being implemented.

See https://peps.python.org/pep-0629/ for details.

tracks: list[str]

If a repository, a list of project/repository URLs being “tracked” by the extending repository.

See https://peps.python.org/pep-0708/#repository-tracks-metadata for details.

Deprecated since version 2.1.0: This attribute is deprecated as result of PEP 708 being rejected. It will be removed in 3.0.0.

class pypiwrap.objects.simple_repo.ProjectPage(meta: Meta, name: str, alternate_locations: list[str], versions: list[str], files: list[DistributionFile], status: ProjectStatus = ProjectStatus.ACTIVE, status_reason: str | None = None)

Bases: APIObject

A project page from the Simple Repository API.

alternate_locations: list[str]

A list of alternate locations or namespaces for this project.

See https://peps.python.org/pep-0708/#alternate-locations-metadata for details.

Added in version 2.0.0.

Deprecated since version 2.1.0: This attribute is deprecated as result of PEP 708 being rejected. It will be removed in 3.0.0.

files: list[DistributionFile]

A list of distribution files for this project.

meta: Meta

Information about the response.

Added in version 2.0.0.

name: str

The name of this project.

status: ProjectStatus = 'active'

The project status marker as described in PEP 792. See ProjectStatus for details on possible values. The default value is ProjectStatus.ACTIVE.

Added in version 2.1.0.

status_reason: str | None = None

The reason or description of the project status marker, if any.

Added in version 2.1.0.

versions: list[str]

A list of all available versions for this project.

class pypiwrap.objects.simple_repo.ProjectStatus(*values)

Bases: str, Enum

The project status marker as documented by PEP 792.

See https://peps.python.org/pep-0792/ for details.

Added in version 2.1.0.

ACTIVE = 'active'

The project is active. This is the default status.

ARCHIVED = 'archived'

The project does not expect to be updated in the future.

DEPRECATED = 'deprecated'

The project is considered obsolete, and may have been superseded by another project.

QUARANTINED = 'quarantined'

The project is considered generally unsafe to use, e.g. due to malware.