API Reference

qip

qip.install(requests, output_path, definition_path=None, overwrite=False, no_dependencies=False, editable_mode=False, python_target='/home/docs/checkouts/readthedocs.org/user_builds/qip/envs/latest/bin/python', registry_paths=None, update_existing_definitions=False, continue_on_error=False)[source]

Install packages to output_path from requests.

Parameters:
  • requests

    List of package requests to be installed.

    A request can be one of:

    ["."]
    ["/path/to/foo/"]
    ["foo", "bar"]
    ["foo==0.1.0"]
    ["foo >= 7, < 8"]
    ["git@gitlab:rnd/foo.git"]
    ["git@gitlab:rnd/foo.git@0.1.0"]
    ["git@gitlab:rnd/foo.git@dev"]
    
  • output_path – Destination path for Python packages installation.
  • definition_path – Destination path for Wiz definitions automatically created for Python packages installed. Default is None, which means that no Wiz definitions are created.
  • overwrite – Indicate whether packages already installed in destination path and corresponding Wiz definitions should be overwritten. If None, a user confirmation will be prompted. Default is False.
  • no_dependencies – Indicate whether package dependencies should be skipped. Default is False.
  • editable_mode – Indicate whether the Python package location should target the source installation package. Default is False.
  • python_target – Target a specific Python version via a Wiz request or a path to a Python executable (e.g. “python==2.7.*” or “/path/to/bin/python”). Default is the path to the current Python executable.
  • registry_paths – List of Wiz registry paths to consider when fetching existing definitions to update or skip.
  • update_existing_definitions – Indicate whether variants from existing definitions should be used when exporting new definitions.
  • continue_on_error – Indicate whether installation process should continue if a package cannot be installed. Default is False.
Raises:

RuntimeError if a package cannot be installed and continue_on_error is set to False.

Returns:

Boolean value indicating whether packages were installed.

qip.copy_to_destination(mapping, source_path, destination_path, overwrite=False)[source]

Copy package from source_path to destination_path.

Parameters:
  • mapping – mapping of the python package built as returned by qip.package.install().
  • source_path – path where the package was built.
  • destination_path – path to install to.
  • overwrite – indicate whether packages already installed should be overwritten. If None, a user confirmation will be prompted. Default is False.
Returns:

tuple with one boolean value indicating whether the copy has been skipped and one indicating a new value for the overwrite option.

qip.fetch_context_mapping(path, python_target)[source]

Return context mapping containing environment and python mapping.

Parameters:
  • path – path where python package has been installed.
  • python_target – Target a specific Python version via a Wiz request or a path to a Python executable (e.g. “python==2.7.*” or “/path/to/bin/python”).
Returns:

Context mapping.

It should be in the form of:

{
    "environ": {
        "PATH": "/path/to/bin",
        "PYTHONPATH": "/path/to/lib/python2.7/site-packages",
    },
    "python": {
        "identifier": "2.7",
        "request": "python >= 2.7, < 2.8",
        "installation-target": "lib/python2.7/site-packages"
    }
}