salt.modules.virtualenv

Create virtualenv environments.

New in version 0.17.0.

salt.modules.virtualenv_mod.create(path, venv_bin=None, system_site_packages=False, distribute=False, clear=False, python=None, extra_search_dir=None, never_download=None, prompt=None, pip=False, symlinks=None, upgrade=None, user=None, use_vt=False, saltenv='base', **kwargs)

Create a virtualenv

path

The path to the virtualenv to be created

venv_bin

The name (and optionally path) of the virtualenv command. This can also be set globally in the pillar data as venv_bin. Defaults to pyvenv or virtualenv, depending on what is installed.

system_site_packagesFalse

Passthrough argument given to virtualenv or pyvenv

distributeFalse

Passthrough argument given to virtualenv

pipFalse

Install pip after creating a virtual environment. Implies distribute=True

clearFalse

Passthrough argument given to virtualenv or pyvenv

pythonNone (default)

Passthrough argument given to virtualenv

extra_search_dirNone (default)

Passthrough argument given to virtualenv

never_downloadNone (default)

Passthrough argument given to virtualenv if True

promptNone (default)

Passthrough argument given to virtualenv if not None

symlinksNone

Passthrough argument given to pyvenv if True

upgradeNone

Passthrough argument given to pyvenv if True

userNone

Set ownership for the virtualenv

Note

On Windows you must also pass a password parameter. Additionally, the user must have permissions to the location where the virtual environment is being created

runasNone

Set ownership for the virtualenv

Deprecated since version 2014.1.0: user should be used instead

use_vtFalse

Use VT terminal emulation (see output while installing)

New in version 2015.5.0.

saltenv'base'

Specify a different environment. The default environment is base.

New in version 2014.1.0.

Note

The runas argument is deprecated as of 2014.1.0. user should be used instead.

CLI Example:

salt '*' virtualenv.create /path/to/new/virtualenv
salt.modules.virtualenv_mod.get_distribution_path(venv, distribution)

Return the path to a distribution installed inside a virtualenv

New in version 2016.3.0.

venv

Path to the virtualenv.

distribution

Name of the distribution. Note, all non-alphanumeric characters will be converted to dashes.

CLI Example:

salt '*' virtualenv.get_distribution_path /path/to/my/venv my_distribution
salt.modules.virtualenv_mod.get_resource_content(venv, package=None, resource=None)

Return the content of a package resource installed inside a virtualenv

New in version 2015.5.0.

venv

Path to the virtualenv

package

Name of the package in which the resource resides

New in version 2016.3.0.

resource

Name of the resource of which the content is to be returned

New in version 2016.3.0.

CLI Example:

salt '*' virtualenv.get_resource_content /path/to/my/venv my_package my/resource.xml
salt.modules.virtualenv_mod.get_resource_path(venv, package=None, resource=None)

Return the path to a package resource installed inside a virtualenv

New in version 2015.5.0.

venv

Path to the virtualenv

package

Name of the package in which the resource resides

New in version 2016.3.0.

resource

Name of the resource of which the path is to be returned

New in version 2016.3.0.

CLI Example:

salt '*' virtualenv.get_resource_path /path/to/my/venv my_package my/resource.xml
salt.modules.virtualenv_mod.get_site_packages(venv)

Return the path to the site-packages directory of a virtualenv

venv

Path to the virtualenv.

CLI Example:

salt '*' virtualenv.get_site_packages /path/to/my/venv