invirtualenv.deploy module

Module to create/deploy a virtualenv

invirtualenv.deploy.build_deploy_virtualenv(arguments=None, configuration=None, update_existing=True, verbose=None)

Build and deploy a python virtualenv

Parameters:
  • arguments (argparse namespace, optional) – An argparse namespace with all of the required command line arguments defaults to parsing the command line arguments if not provided.
  • configuration (str or list, optional) – A configuration file or list of configuration files to parse, defaults to the deploy_default.conf file in the package and deploy.conf in the current working directory.
  • update_existing (bool) – If True, allow updating an existing virtualenv, Otherwise generate an exception. Default=True
  • verbose (bool) – If True, provides status output while running.
Raises:
  • AlreadyExists – The virtualenv already exists
  • BuildError – The specified package manifest cannot be deployed to the virtualenv
  • InsufficientPermissions – The current user lacks permissions to complete the specified operation
  • NoPackageVersions – A virtualenv_version_package was specified in the configuration but no versions for that package where found on artifactory.
invirtualenv.deploy.deployed_bin_files(venv)

Gets files that where deployed to the bin directory of the virtualenv.

Parameters:venv (str) – Path the to virtualenv to do this bin_file links for
Returns:Key = filename Value = sha256 hash
Return type:dict
invirtualenv.deploy.fix_file_ownership(virtualenv, user, group)

Fix the file ownership of a virtualenv

Parameters:
  • virtualenv (str) – Virtualenv path
  • user (str) – User to change to
  • group (str) – Group to change to

:param : :type : return:

invirtualenv.deploy.install_python_dependencies(virtualenv, deps=None, requirements=None, upgrade=False, verbose=False, pip_version=None, use_index=True, use_local_wheels=False)

Install python dependencies from a requirements file or deploy.conf manifest

Parameters:
  • virtualenv (str) – The virtualenv to install into
  • deps (list, optional) – A list of python packages to install
  • requirements (str, optional) – The requirements.txt file to install from
  • upgrade (bool, optional) – Tell pip to upgrade packages when installing, Default=False
  • verbose (bool, optional) – Display command output when running the dependency operations, Default=False
  • use_index (bool, optional) – Allow pip to use an external index Default=True
  • use_local_wheels (bool, optional) – Install from local wheels directory instead of pypi Default=False
Raises:

BuildException - If package installation fails

invirtualenv.deploy.install_rpm_dependencies(deps=None, fail_missing=True)

Install rpm dependencies from deploy.conf manifest

Parameters:
  • deps (list, optional) – A list of rpm packages to install
  • fail_missing (bool, optional) – Generate an exception and fail if the “yum” command is not available. default = True
Raises:

BuildException - If package installation fails

Link the deployed files from the venv bin directory into the destbin directory.

Writes a json list of the created links to conf/created_links.json in the virtualenv.

Parameters:
  • venv (str) – Path to the python virtualenv
  • destbin (str) – Destination directory when the links should be
Returns:

Full path to files linked

Return type:

list

Undo/delete the symlinks created by link_deployed_bin_files()

Parameters:venv (str) – Path to the root of the virtualenv