shippinglabel

Utilities for handling packages.

Functions:

get_project_links(project_name[, path])

Returns the web links for the given project.

no_dev_versions(versions)

Returns the subset of versions which does not end with -dev.

no_pre_versions(versions)

Returns the subset of versions which are not prereleases (alpha, beta, dev, rc etc.).

normalize(name)

Normalize the given name for PyPI et al.

normalize_keep_dot(name)

Normalize the given name for PyPI et al., but keep dots in namespace packages.

read_pyvenv(venv_dir)

Reads the pyvenv.cfg for the given virtualenv, and returns a key: value mapping of its contents.

Returns the web links for the given project.

The exact keys vary, but common keys include “Documentation” and “Issue Tracker”.

New in version 0.12.0.

Parameters
Return type

MetadataMapping

Changed in version 1.0.0: Now returns a dist_meta.metadata_mapping.MetadataMapping object.

Changed in version 1.2.0: The Home-Page field from Python core metadata is included under the Homepage key, if present. This matches the output parsed from PyPI for packages which are not installed.

Changed in version 1.7.0: Added the path argument.

no_dev_versions(versions)[source]

Returns the subset of versions which does not end with -dev.

Parameters

versions (Iterable[str])

Return type

List[str]

no_pre_versions(versions)[source]

Returns the subset of versions which are not prereleases (alpha, beta, dev, rc etc.).

New in version 0.15.0.

Parameters

versions (Iterable[str])

Return type

List[str]

normalize(name)[source]

Normalize the given name for PyPI et al.

From PEP 503 (public domain).

Parameters

name (str) – The project name.

Return type

str

normalize_keep_dot(name)[source]

Normalize the given name for PyPI et al., but keep dots in namespace packages.

New in version 0.2.1.

Parameters

name (str) – The project name.

Return type

str

read_pyvenv(venv_dir)[source]

Reads the pyvenv.cfg for the given virtualenv, and returns a key: value mapping of its contents.

New in version 0.9.0.

Parameters

venv_dir (Union[str, Path, PathLike])

Return type

Dict[str, str]