Vox (xontrib.voxapi
)¶
API for Vox, the Python virtual environment manager for xonsh.
Vox defines several events related to the life cycle of virtual environments:
vox_on_create(env: str) -> None
vox_on_activate(env: str) -> None
vox_on_deactivate(env: str) -> None
vox_on_delete(env: str) -> None
-
exception
xontrib.voxapi.
EnvironmentInUse
[source]¶ The given environment is currently activated, and the operation cannot be performed.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
args
¶
-
-
exception
xontrib.voxapi.
NoEnvironmentActive
[source]¶ No environment is currently activated, and the operation cannot be performed.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
args
¶
-
-
class
xontrib.voxapi.
VirtualEnvironment
(env, bin, lib, inc)¶ Create new instance of VirtualEnvironment(env, bin, lib, inc)
-
count
($self, value, /)¶ Return number of occurrences of value.
-
index
($self, value, start=0, stop=sys.maxsize, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
bin
¶ Alias for field number 1
-
env
¶ Alias for field number 0
-
inc
¶ Alias for field number 3
-
lib
¶ Alias for field number 2
-
-
class
xontrib.voxapi.
Vox
[source]¶ API access to Vox and virtual environments, in a dict-like format.
Makes use of the VirtualEnvironment namedtuple:
env
: The full path to the environmentbin
: The full path to the bin/Scripts directory of the environment
-
activate
(name)[source]¶ Activate a virtual environment.
Parameters: name : str
Virtual environment name or absolute path.
-
active
()[source]¶ Get the name of the active virtual environment.
You can use this as a key to get further information.
Returns None if no environment is active.
-
create
(name, interpreter=None, system_site_packages=False, symlinks=False, with_pip=True)[source]¶ Create a virtual environment in $VIRTUALENV_HOME with python3’s
venv
.Parameters: name : str
Virtual environment name
interpreter: str
Python interpreter used to create the virtual environment.
system_site_packages : bool
If True, the system (global) site-packages dir is available to created environments.
symlinks : bool
If True, attempt to symlink rather than copy files into virtual environment.
with_pip : bool
If True, ensure pip is installed in the virtual environment. (Default is True)
-
get
(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
items
() → a set-like object providing a view on D's items¶
-
keys
() → a set-like object providing a view on D's keys¶
-
upgrade
(name, symlinks=False, with_pip=True, interpreter=None)[source]¶ Create a virtual environment in $VIRTUALENV_HOME with python3’s
venv
.WARNING: If a virtual environment was created with symlinks or without PIP, you must specify these options again on upgrade.
Parameters: name : str
Virtual environment name
interpreter: str
The Python interpreter used to create the virtualenv
symlinks : bool
If True, attempt to symlink rather than copy files into virtual environment.
with_pip : bool
If True, ensure pip is installed in the virtual environment.
-
values
() → an object providing a view on D's values¶