serena.util.pypi#


Utilities for querying package information from the Python Package Index (PyPI).

class PyPIPackageInfo(package_name)[source]#

Bases: object

Provider of information on a package hosted on the Python Package Index (PyPI).

Information is retrieved on demand via PyPI’s JSON API.

Parameters:

package_name (str) – the name of the package on PyPI (e.g. “requests”)

get_latest_version(timeout_secs=5)[source]#

Retrieves the latest released version of the package from PyPI.

Returns:

the latest version string (e.g. “2.33.0”)

Raises:

requests.RequestException – if the HTTP request fails or PyPI responds with an error status

Parameters:

timeout_secs (int)

Return type:

str