module installhelper.module_install
¶
Short summary¶
module pymyinstall.installhelper.module_install
Various function to install various python module from various location.
Classes¶
class | truncated documentation |
---|---|
AnnoyingPackageException |
raised when a package is not on pypi |
MissingInstalledPackageException |
raised when a package is not installed |
MissingPackageOnPyPiException |
raised when a package is not found on pipy |
MissingVersionOnPyPiException |
raised when a version is missing on pipy |
ModuleInstall |
defines the necessary information for a module .. _le-module_install-l235: .. _le-InstallationfromGitHub: ... |
Functions¶
function | truncated documentation |
---|---|
_get_pypi_version_memoize |
|
helper |
Properties¶
property | truncated documentation |
---|---|
ImportName |
return the import name |
Purpose |
returns the comment |
Script |
returns the script to run if the extension is an application and not a module |
Static Methods¶
staticmethod | truncated documentation |
---|---|
clear_cache |
clear the local cache to get wheel link |
compare_version |
compare two versions |
is_annoying |
some modules are not available on pipy |
numeric_version |
convert a string into a tuple with numbers whever possible |
Methods¶
method | truncated documentation | ||
---|---|---|---|
__cmp__ |
to sort modules | ||
__init__ |
constructor | ||
__lt__ |
overload operator | ||
__str__ |
usual | ||
as_dict |
returns the members in a dictionary | ||
copy |
copy the module, if version is not None, change the version number | ||
download |
download the module without installation | ||
get_exewheel_url_link |
for windows, get the url of the setup using a webpage | ||
get_exewheel_url_link_xd |
for windows, get the url of the setup using a webpage | ||
get_installated_numeric_version |
returns the version as number (not string) | ||
get_installed_version |
return the version of the installed package | ||
get_pypi_numeric_version |
returns the version of a package in pypi | ||
get_pypi_version |
returns the version of a package on pypi | ||
has_update |
tells if the package has a newer version on pipy | ||
Install |
|
||
install |
install the package | ||
is_installed |
tells if a module is installed | ||
IsInstalled |
checks if a module is installed | ||
unzipfiles |
unzip files from a zip archive | ||
update |
update the package if necessary, we use |
Documentation¶
Various function to install various python module from various location.
-
exception
pymyinstall.installhelper.module_install.
AnnoyingPackageException
[source]¶ Bases:
Exception
raised when a package is not on pypi
-
exception
pymyinstall.installhelper.module_install.
MissingInstalledPackageException
[source]¶ Bases:
Exception
raised when a package is not installed
-
exception
pymyinstall.installhelper.module_install.
MissingPackageOnPyPiException
[source]¶ Bases:
Exception
raised when a package is not found on pipy
-
exception
pymyinstall.installhelper.module_install.
MissingVersionOnPyPiException
[source]¶ Bases:
Exception
raised when a version is missing on pipy
-
class
pymyinstall.installhelper.module_install.
ModuleInstall
(name, kind='pip', gitrepo=None, mname=None, fLOG=<built-in function print>, version=None, script=None, index_url=None, deps=None, purpose=None, usage=None)[source]¶ Bases:
object
defines the necessary information for a module
Example: Installation from GitHub
ModuleInstall("pyquickhelper", "github", "sdpython").install(temp_folder="temp")
constructor
Parameters: - name – name
- kind – kind of installation (pip, github, wheel)
- gitrepo – github repository (example: sdpython)
- mname – sometimes, the module name is different from its official name
- version – to install a specific version (None for the latest)
- fLOG – logging function
- script – some extensions are not a module but an application (such as
spyder
), the class will check this script is available - deps – overwrite deps parameters when installing the module
- index_url – to get the package from a custom pypi server
- purpose – purpose of the module
- usage – main usage for the module
-
ImportName
¶ return the import name
-
Purpose
¶ returns the comment
-
Script
¶ returns the script to run if the extension is an application and not a module
-
__init__
(name, kind='pip', gitrepo=None, mname=None, fLOG=<built-in function print>, version=None, script=None, index_url=None, deps=None, purpose=None, usage=None)[source]¶ constructor
Parameters: - name – name
- kind – kind of installation (pip, github, wheel)
- gitrepo – github repository (example: sdpython)
- mname – sometimes, the module name is different from its official name
- version – to install a specific version (None for the latest)
- fLOG – logging function
- script – some extensions are not a module but an application (such as
spyder
), the class will check this script is available - deps – overwrite deps parameters when installing the module
- index_url – to get the package from a custom pypi server
- purpose – purpose of the module
- usage – main usage for the module
-
static
compare_version
(num, vers)[source]¶ compare two versions
Parameters: - num – first version
- vers – second version
Returns: -1, 0, 1
-
copy
(version=None)[source]¶ copy the module, if version is not None, change the version number
Parameters: version – version number or None for unchanged Returns: ModuleInstall
New in version 1.0.
-
download
(temp_folder='.', force=False, unzipFile=True, file_save=None, deps=False)[source]¶ download the module without installation
Parameters: - temp_folder – destination
- force – force the installation even if already installed
- unzipFile – if it can be unzipped, it will be (for github, mostly)
- file_save – for debug purposes, do not change it unless you know what you are doing
- deps – download the dependencies too (only available for pip)
Returns: downloaded files
Changed in version 0.9: Parameter deps was added, the function now downloads a module using pip.
Changed in version 1.0: deps is overwritten by self.deps if not None
-
get_exewheel_url_link
(file_save=None, wheel=False)[source]¶ for windows, get the url of the setup using a webpage
Parameters: - file_save – for debug purposes
- wheel – returns the wheel file or the exe file
Returns: url, exe name
-
get_exewheel_url_link_xd
(file_save=None, wheel=False)[source]¶ for windows, get the url of the setup using a webpage
Parameters: - file_save – for debug purposes
- wheel – returns the wheel file or the exe file
Returns: url, exe name
-
get_pypi_version
(url='http://pypi.python.org/pypi')[source]¶ returns the version of a package on pypi
Parameters: url – pipy server Returns: version See also installing_python_packages_programatically.py, pkgtools.pypi: PyPI interface.
-
install
(force_kind=None, force=False, temp_folder='.', log=False, options=None, deps=False)[source]¶ install the package
Parameters: - force_kind – overwrite self.kind
- force – force the installation even if already installed
- temp_folder – folder where to download the setup
- log – display logs or not
- options – other options to add to the command line (see below) in a list
- deps – install the dependencies too (only available for pip)
Returns: boolean
The options mentioned in parameter
options
are described here: pip install or setup.py options if you installing a module from github.Changed in version 1.0: deps is overwritten by self.deps if not None
-
static
numeric_version
(vers)[source]¶ convert a string into a tuple with numbers whever possible
Parameters: vers – string Returns: tuple
-
unzipfiles
(zipf, whereTo)[source]¶ unzip files from a zip archive
Parameters: - zipf – archive
- whereTo – destination folder
Returns: list of unzipped files
-
update
(force_kind=None, force=False, temp_folder='.', log=False, options=None, deps=False)[source]¶ update the package if necessary, we use
pip install <module_name> --upgrade --no-deps
,Parameters: - force_kind – overwrite self.kind
- force – force the installation even if not need to update
- temp_folder – folder where to download the setup
- log – display logs or not
- options – others options to add to the command line (see below) an a list
- deps – download the dependencies too (only available for pip)
Returns: boolean
The options mentioned in parameter
options
are described here: pip install or setup.py options if you installing a module from github.