pypi

PyPi index utils.

exception confirm.utils.pypi.NewerVersionFound(name: str, version: str)

Exception which is thrown when a newer package version was found.

Args:

name: The package name version: The new package version

class confirm.utils.pypi.PackageInfo(name: str, pypi_index: str = 'https://pypi.confirm.ch/')

A parser to parse a single package from a PyPi simple package index.

Args:

name: The package name pypi_index: The URL of the PyPi index

check_version(version: str) → None

Checks if there’s a newer version than version available.

Raises:

NewerVersionFound: In case a newer version was found

Hint

This includes only stable versions for now.

fetch() → None

Fetch the package informations from the PyPi index.

handle_data(data: str) → None

Handle the data found in the HTML content.

Args:

data: The data of the HTML tag

property latest_version: str

The latest stable version.

Hint

This includes only stable versions for now.

property names: set[str]

The names of all packages.

property stable_versions: set[str]

The stable version numbers of all packages.

classmethod str_version(version: tuple[int, ...]) → str

Convert the tuple version into a string.

Hint

Examples:

>>> version = PackageInfo.str_version(tuple((1, 2, 3)))
>>> version
'1.2.3'
>>> type(version)
<class 'str'>
classmethod tuple_version(version: str) → tuple[int, ...]

Convert the string version into a tuple.

Hint

Examples:

>>> version = PackageInfo.tuple_version('1.2.3')
>>> version
(1, 2, 3)
>>> type(version)
<class 'tuple'>
property versions: set[str]

The version numbers of all packages.