shippinglabel.pypi
Attention
This module is deprecated and will be removed in v2.0.0.
Please use the new shippinglabel_pypi
extension instead.
Utilities for working with the Python Package Index (PyPI).
New in version 0.2.0.
See also
pypi-json, which provides some of the functionality from this module but with a reusable HTTP session and support for authentication with other endpoints (such as a private package repository).
Classes:
|
Data:
Instance of |
Functions:
|
Bind unbound requirements in the given file to the latest version on PyPI, and any later versions. |
|
Download the file with the given URL into the given (temporary) directory. |
|
Returns the version number of the latest release on PyPI for the given project. |
|
Returns metadata for the given project on PyPI. |
|
Returns a dictionary mapping PyPI release versions to download URLs. |
|
Returns a dictionary mapping PyPI release versions to download URLs and the sha256sum of the file contents. |
|
Returns the URL of the project’s source distribution on PyPI. |
|
Constructs a mapping of wheel tags to the PyPI download URL of the wheel with relevant tag. |
|
Returns the URL of one of the project’s wheels on PyPI. |
-
typeddict
FileURL
[source] Bases:
TypedDict
typing.TypedDict
representing the output ofget_releases_with_digests()
.New in version 0.6.1.
-
PYPI_API
= SlumberURL('https://pypi.org/pypi') Type:
SlumberURL
Instance of
apeye.slumber_url.SlumberURL
which points to the PyPI REST API.Changed in version 0.3.0: Now an instance of
apeye.slumber_url.SlumberURL
.
-
bind_requirements
(filename, specifier='>=', normalize_func=<function 'normalize'>)[source] Bind unbound requirements in the given file to the latest version on PyPI, and any later versions.
New in version 0.2.0.
- Parameters
Changed in version 0.2.3: Added the
normalize_func
keyword-only argument.- Return type
- Returns
1
if the file was changed;0
otherwise.
-
get_file_from_pypi
(url, tmpdir)[source] Download the file with the given URL into the given (temporary) directory.
New in version 0.6.0.
-
get_latest
(pypi_name)[source] Returns the version number of the latest release on PyPI for the given project.
New in version 0.2.0.
- Parameters
pypi_name (
str
)- Raises
packaging.requirements.InvalidRequirement
if the project cannot be found on PyPI.apeye.slumber_url.exceptions.HttpServerError
if an error occurs when communicating with PyPI.
- Return type
-
get_metadata
(pypi_name)[source] Returns metadata for the given project on PyPI.
New in version 0.2.0.
- Parameters
pypi_name (
str
)- Raises
packaging.requirements.InvalidRequirement
if the project cannot be found on PyPI.apeye.slumber_url.exceptions.HttpServerError
if an error occurs when communicating with PyPI.
- Return type
-
get_pypi_releases
(pypi_name)[source] Returns a dictionary mapping PyPI release versions to download URLs.
New in version 0.3.0.
- Parameters
pypi_name (
str
) – The name of the project on PyPI.- Raises
packaging.requirements.InvalidRequirement
if the project cannot be found on PyPI.apeye.slumber_url.exceptions.HttpServerError
if an error occurs when communicating with PyPI.
- Return type
-
get_releases_with_digests
(pypi_name)[source] Returns a dictionary mapping PyPI release versions to download URLs and the sha256sum of the file contents.
New in version 0.6.0.
- Parameters
pypi_name (
str
) – The name of the project on PyPI.- Raises
packaging.requirements.InvalidRequirement
if the project cannot be found on PyPI.apeye.slumber_url.exceptions.HttpServerError
if an error occurs when communicating with PyPI.
- Return type
-
get_sdist_url
(name, version, strict=False)[source] Returns the URL of the project’s source distribution on PyPI.
New in version 0.13.0.
- Parameters
Attention
If no source distribution is found this function may return a wheel or “zip” sdist unless
strict
isTrue
.Changed in version 0.15.0: Added the
strict
argument.- Return type
-
get_wheel_tag_mapping
(name, version)[source] Constructs a mapping of wheel tags to the PyPI download URL of the wheel with relevant tag.
This can be used alongside
packaging.tags.sys_tags()
to select the best wheel for the current platform.New in version 0.15.0.
-
get_wheel_url
(name, version, strict=False)[source] Returns the URL of one of the project’s wheels on PyPI.
For finer control over which wheel the URL is for see the
get_wheel_tag_mapping()
function.New in version 0.15.0.
- Parameters
Attention
If no wheels are found this function may return an sdist unless
strict
isTrue
.- Return type