get_pypi_latest_version package

Submodules

class get_pypi_latest_version.main.GetPyPiLatestVersion(url: str = 'https://pypi.org/')[source]

Bases: object

Get the latest version of the specified python package name in the pypi.

__init__(url: str = 'https://pypi.org/') None[source]
__call__(package_name: str, return_all_versions: bool = False) Union[str, Tuple[str, List]][source]

_summary_

Parameters:
  • package_name (str) – The name of the package you want to get the latest version.

  • return_all_versions (bool, optional) – Whether to return all release versions. Default is False .

Raises:

ValueError – The exception is thrown when no valid package information is found.

Returns:

the latest version. When return_all_versions=True , Return Tuple: [latest_version_str, all_release_list]

Return type:

Union[str, Tuple[str, List]]

get_by_spider_web(package_name: str) str[source]
get_all_release_versions(package_info: Dict)[source]
get_by_pip_index(package_name: str) List[source]
extract_version(message: str) str[source]

Extract the version string matched the semver 2.0.0 from the string.

Parameters:

message (str) – the text with the version num.

Returns:

‘’ or ‘x.x.x’

Return type:

str

static version_add_one(version: Optional[str], add_loc: int = -1) str[source]

Add one for direct version.

Parameters:
  • version (Optional[str]) – current version num

  • add_loc (int, optional) – Where to add one from the back to front. Default is -1. e.g. 4.0.7, when add_loc=-1 → 4.0.8, add_loc=-2 → 4.1.0, add_loc=-3 → 5.0.0.

Returns:

the version after adding one.

Return type:

str

get_pypi_latest_version.main.main()[source]