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 |
---|---|
defines the necessary information for a module |
Functions¶
function |
truncated documentation |
---|---|
Properties¶
property |
truncated documentation |
---|---|
return the import name |
|
returns the comment |
|
returns the script to run if the extension is an application and not a module |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
clear the local cache to get wheel link |
|
some modules are not available on pipy |
Methods¶
method |
truncated documentation |
---|---|
to sort modules |
|
overload operator |
|
usual |
|
usual |
|
some modules uninstall and install modules with another version number, we try to track that |
|
returns the members in a dictionary |
|
copy the module, if version is not None, change the version number |
|
Downloads the module without installation. |
|
extract the version from a filename |
|
for windows, get the url of the setup using a webpage |
|
for windows, get the url of the setup using a webpage |
|
return the classifier of the installed package |
|
return the license of the installed package |
|
return the metadata of the installed package |
|
returns the version as number (not string) |
|
return the version of the installed package |
|
returns the version of a package in pypi |
|
returns the version of a package on pypi |
|
tells if the package has a newer version on pipy |
|
Installs the package. |
|
checks if a module is installed |
|
Test the module by running a command line. Does some others verifications for a specific modules such as scipy. |
|
tells if a module is installed |
|
Run some preprocessing for specific modules |
|
Run instructions post installation |
|
unzip files from a zip archive |
|
Updates the package if necessary, we use |
Documentation¶
Various function to install various python module from various location.
- 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, web=None, source=None, custom=None, branch='master', pip_options=None, overwrite=None, post=None, skip_import=False, pipgit=False)¶
Bases:
object
defines the necessary information for a module
Installation from GitHub
ModuleInstall("pyquickhelper", "github", "sdpython").install(temp_folder="temp")
- 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 availabledeps – 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
web – website for the module, if None, default to pipy
source – to overwrite parameter source of methods
download
,install()
orupdate()
.custom – custom instructions to install, usually
['build', 'install']
to runsetup.py build
andsetup.py install
branch – only necessary for install process with github
pip_options – additional options for pip (list)
overwrite – overwrite the location of the wheel
post – instructions post installation (look for this parameter in the code to see what is supported)
pipgit – install the module with
pip + git
instead of getting the full archiveskip_import – added to indicate the module cannot be imported
Changed in version 1.1: Parameters source, custom, branch, pip_options, overwrite, post were added. Parameter skip_import was introduced to skip the checking of the installation. Parameter pipgit was added.
- property ImportName¶
return the import name
- property Purpose¶
returns the comment
- property Script¶
returns the script to run if the extension is an application and not a module
- __cmp__(o)¶
to sort modules
- Parameters:
o – other module
- Returns:
-1, 0, 1
- __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, web=None, source=None, custom=None, branch='master', pip_options=None, overwrite=None, post=None, skip_import=False, pipgit=False)¶
- 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 availabledeps – 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
web – website for the module, if None, default to pipy
source – to overwrite parameter source of methods
download
,install()
orupdate()
.custom – custom instructions to install, usually
['build', 'install']
to runsetup.py build
andsetup.py install
branch – only necessary for install process with github
pip_options – additional options for pip (list)
overwrite – overwrite the location of the wheel
post – instructions post installation (look for this parameter in the code to see what is supported)
pipgit – install the module with
pip + git
instead of getting the full archiveskip_import – added to indicate the module cannot be imported
Changed in version 1.1: Parameters source, custom, branch, pip_options, overwrite, post were added. Parameter skip_import was introduced to skip the checking of the installation. Parameter pipgit was added.
- __lt__(o)¶
overload operator
<
- Parameters:
o – other module
- Returns:
boolean
- __repr__()¶
usual
- __str__()¶
usual
- _check_installation()¶
some modules uninstall and install modules with another version number, we try to track that
- _page_cache_html = 'somewhere/workspace/pymyinstall/pymyinstall_UT_39_std/_doc/sphinxdoc/source/pymyinstall/installhelper/page.html'¶
- _page_cache_html2 = 'somewhere/workspace/pymyinstall/pymyinstall_UT_39_std/_doc/sphinxdoc/source/pymyinstall/installhelper/page2.html'¶
- as_dict(rst_link=False)¶
returns the members in a dictionary
- Parameters:
rst_link – if True, add rst_link, license, classifier
- Returns:
dictionary
- static clear_cache()¶
clear the local cache to get wheel link
- copy(version=None)¶
copy the module, if version is not None, change the version number
- Parameters:
version – version number or None for unchanged
- Returns:
New in version 1.0.
- download(temp_folder='.', force=False, unzipFile=True, file_save=None, deps=False, source=None)¶
Downloads 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)
source – overwrite source of the download, only for wheel packages, see
get_exewheel_url_link2
- Returns:
downloaded files
deps is overwritten by self.deps if not None If source is None, it is overwritten by self.source.
- extract_version(name)¶
extract the version from a filename
- Parameters:
name – filename
- Returns:
verions (str)
- get_exewheel_url_link(file_save=None, wheel=False)¶
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_link2(file_save=None, wheel=False, source=None)¶
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
source – source of the wheels (ex:
2
orhttp://...
)
- Returns:
url, exe name
Changed in version 1.1: Parameter source was added.
- get_installed_classifier()¶
return the classifier of the installed package
- Returns:
string
- get_installed_license()¶
return the license of the installed package
- Returns:
string
- get_installed_metadata()¶
return the metadata of the installed package
- Returns:
dictionary
- get_installed_numeric_version()¶
returns the version as number (not string)
- Returns:
tuple
- get_installed_version()¶
return the version of the installed package
- Returns:
version
- get_pypi_numeric_version()¶
returns the version of a package in pypi
- Returns:
tuple
- get_pypi_version(url='https://pypi.python.org/pypi')¶
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.
- has_update()¶
tells if the package has a newer version on pipy
- Returns:
boolean
- install(force_kind=None, force=False, temp_folder='.', log=False, options=None, deps=False, source=None, custom=None, post=None, out_streams=None)¶
Installs 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)
source – overwrite the source of the wheels, see
get_exewheel_url_link2
custom – overwrite parameters in
self.custom
post – instructions post installation (see the cnostructor for more help)
out_streams – if it is a list, the function will add standard outputs
- 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
Changed in version 1.1: On Anaconda (based on function
is_conda_distribution
), we try conda first before switching to the regular way if it did not work. Exception were changed fromException
toInstallError
. Parameter source was added, if None, it is overwritten by self.source. Parameter custom was added, it works the same as source. Parameter post was added. Parameter out_streas added.
- static is_annoying(module_name)¶
some modules are not available on pipy
- is_installed_local()¶
checks if a module is installed
- is_installed_local_cmd()¶
Test the module by running a command line. Does some others verifications for a specific modules such as scipy.
New in version 1.1.
- is_installed_version()¶
tells if a module is installed
- Returns:
boolean
- module_install_preprocess(post)¶
Run some preprocessing for specific modules
- Parameters:
post – dictionary
- run_post_installation(post)¶
Run instructions post installation
- Parameters:
post – dictionary, instructions post installation
- Returns:
boolean
Example:
post = dict( cmd_python="Scripts\\pywin32_postinstall.py -install")
New in version 1.1.
- unzipfiles(zipf, whereTo)¶
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=None)¶
Updates 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)
source – overwrite the source of the wheel, see
get_exewheel_url_link2
- 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.1: Parameter source was added, if None, it is overwritten by self.source.
- pymyinstall.installhelper.module_install._filter_pip_out(out)¶