module installhelper.module_install_version
¶
Short summary¶
module pymyinstall.installhelper.module_install_version
Functions to get module version, license, dependencies
Functions¶
function |
truncated documentation |
---|---|
Chooses the most recent version for a list of module names. |
|
Compares two versions. |
|
Returns the dependencies for a module. |
|
Returns a dictionary |
|
Returns a dictionary |
|
Returns the version of a package on pypi, we skip alpha, beta or dev version. |
|
extract the version from a wheel file, return |
|
Tells if a module is installed or not. |
|
convert a string into a tuple with numbers wherever possible |
|
v1 and v2 are two versions of the same module, which one to keep? |
Documentation¶
Functions to get module version, license, dependencies
- pymyinstall.installhelper.module_install_version._get_pypi_version_memoize_op(f)¶
- pymyinstall.installhelper.module_install_version.choose_most_recent(list_name)¶
Chooses the most recent version for a list of module names.
- Parameters:
list_name – list of names
- Returns:
most recent version or None if the input list is empty
In the following case, we would choose the first option:
numpy-1.10.0+mkl-cp34-none-win_amd64.whl numpy-1.9.1.0+mkl-cp34-none-win_amd64.whl
- pymyinstall.installhelper.module_install_version.compare_version(num, vers)¶
Compares two versions.
- Parameters:
num – first version
vers – second version
- Returns:
-1, 0, 1
- pymyinstall.installhelper.module_install_version.get_module_dependencies(module, use_cmd=False, deep=False, collapse=True, use_pip=None, refresh_cache=False)¶
Returns the dependencies for a module.
- Parameters:
module – unused, None
use_cmd – use command line
deep – dig into dependencies of dependencies
collapse – only one row per module
use_pip – use pip to discover dependencies or not (parse metadata)
refresh_cache – refresh the cache (see below)
- Returns:
list of tuple (module, version, required by as a str) or dictionary { module: (version, required by as a list) } if collapse is True
The function which uses use_pip=True is not fully tested, it does not return contraints (== 2.4). The function caches the results to avoid doing it again during a second execution unless refresh_cache is True. This function is not tested on Python 2.7.
- pymyinstall.installhelper.module_install_version.get_module_metadata(module, use_cmd=False, refresh_cache=False)¶
Returns a dictionary
{ module: metadata }
.- Parameters:
module – unused, None
refresh_cache – refresh the cache before getting metadata
- Returns:
dictionary
- pymyinstall.installhelper.module_install_version.get_module_version(module, use_cmd=False)¶
Returns a dictionary
{ module: version }
.- Parameters:
module – unused, None
use_cmd – use command line
- Returns:
dictionary
- pymyinstall.installhelper.module_install_version.get_pypi_version(module_name, full_list=False, url='https://pypi.python.org/pypi', skip_betas=True)¶
Returns the version of a package on pypi, we skip alpha, beta or dev version.
- Parameters:
module_name – module name
url – pypi server
full_list – results as a list or return the last stable version
skip_betas – skip the intermediate functions
- Returns:
version (str or list)
See also installing_python_packages_programatically.py, pkgtools.pypi: PyPI interface.
It the function fails, check the status of Python Infrastructure. It can return errors:
ProtocolError: ProtocolError for pypi.python.org/pypi: 503 No healthy backends
- pymyinstall.installhelper.module_install_version.get_wheel_version(whlname)¶
extract the version from a wheel file, return
2.6.0
forrpy2-2.6.0-cp34-none-win_amd64.whl
- Parameters:
whlname – file name
- Returns:
string
- pymyinstall.installhelper.module_install_version.is_installed(name)¶
Tells if a module is installed or not.
- Parameters:
name – module name
- Returns:
boolean
- pymyinstall.installhelper.module_install_version.numeric_version(vers)¶
convert a string into a tuple with numbers wherever possible
- Parameters:
vers – string
- Returns:
tuple
- pymyinstall.installhelper.module_install_version.version_consensus(v1, v2)¶
v1 and v2 are two versions of the same module, which one to keep?
- Parameters:
v1 – version 1
v2 – version 2
- Returns:
consensus
v1=None
,v2='(>=1.5)'
–>v='>=1.5'
To improve:
v1='<=1.6'
,v2='(>=1.5)'
–>v='==1.6'