vpip.venv¶
Building venvs.
Constants¶
Functions¶
- vpip.venv.get_global_folder(pkg_name)¶
Get global venv folder for a package.
- vpip.venv.iter_global_packages()¶
Iterate through all venv folders for globally installed packages.
- Return type:
Iterator[str]
- vpip.venv.get_global_pkg_venv(pkg)¶
Get the
Venv
instance pointing the venv folder of the global installed package.
- vpip.venv.get_global_script_folders() Iterable[Path] ¶
Return a list of folders. Which are used to write global scripts.
Following paths are checked against env variable
PATH
:'~/.local/bin' '~/bin' sysconfig.get_path('scripts')
They are only returned if included in
PATH
.
Classes¶
- class vpip.venv.Builder(system_site_packages=False, clear=False, symlinks=False, upgrade=False, with_pip=False, prompt=None, upgrade_deps=False)¶
Bases:
EnvBuilder
An environment builder that could be used inside a venv.
It also upgrades pip to the latest version after installed.
- class vpip.venv.Venv(env_dir)¶
A helper class that is associated to a venv folder. It allows you to easily activate/deactivate the venv.
- Parameters:
env_dir (str) – The target venv folder.
- activate(auto_create=False)¶
Activate the venv. Update PATH and VIRTUAL_ENV environment variables.
- Parameters:
auto_create (bool) – If True then automatically create the venv when the folder doesn’t exist.
This function can be used as a context manager that will
deactivate()
when exited.
- create()¶
Create the venv.
- deactivate()¶
Deactivate the venv.
- destroy()¶
Destroy the venv. Remove the venv folder.