Dephell VEnvs
Manage Python virtual environments.
Installation
Install from PyPI:
python3 -m pip install --user dephell_venvs
Get venv from manager
from pathlib import Path
from dephell_venvs import VEnv, VEnvs
# pass here path with substitutions:
venvs = VEnvs(path=Path() / '{project}-{digest}' / '{env}')
VEnvs gets argument path that is path to the virtual environment with substitutions:
{project}- last part of the path to the project.{digest}- short hash of full path to the project to avoid collisions.{env}- name of sub-environment because most of project need more than one environment. For example,tests,docs,tests-py35.
Ways to get VEnv object from VEnvs:
venvs.get(project_path, env). Pass here path to the project and sub-environment name and DepHell will substitute them is the path template and returnVEnvinstance for this path.venvs.get_by_name(name). Pass only name and this will be substituted as{project}and other substitutions ({digest},{env}) will be just dropped out.venvs.current-- returns current active venv if some venv is active.
Example:
venv = venvs.get(project_path=Path('dephell_venvs'), env='pytest')
# VEnv(path=PosixPath('dephell_venvs/pytest'), project='dephell_venvs', env='pytest')
Manage venv
VEnv can be got from VEnvs ot created manually:
venv = VEnv(path=Path('venv'))
Check existence:
venv.exists()
# False
Create and destroy:
venv.create()
venv.destroy()
Some other useful information:
venv.bin_path
# PosixPath('dephell_venvs-njyT/pytest/bin')
venv.lib_path
# PosixPath('dephell_venvs-njyT/pytest/lib/python3.7/site-packages')
venv.python_path
# PosixPath('dephell_venvs-njyT/pytest/bin/python3.7')
venv.prompt
# 'dephell_venvs/pytest'
venv.python
# Python(path=PosixPath('dephell_venvs-njyT/pytest/bin/python3.7'), version='3.7.0', implementation='python', abstract=False)
For details about Python object see dephell_pythons.
Release files for dephell-venvs 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dephell_venvs-0.1.18.tar.gz | 1.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dephell_venvs-0.1.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.7 MB
Release files / dephell_venvs-0.1.18.tar.gz
| Download URL | dephell_venvs-0.1.18.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7307291b754edba325ab27edeb05d85ee4dd2f1487c48872a1ebfc372bf7a2e
|
|
BLAKE2b-256 checksum How to use checksums |
7679646c78687f459deb5e7a03568907039cd0c87403540571633b044e53b184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
DepHell/0.8.3
|
Release files / dephell_venvs-0.1.18-py3-none-any.whl
| Download URL | dephell_venvs-0.1.18-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd3ad440702aa9a9dc21bbab9633537fa395296d40451280d40046d9e3372e6d
|
|
BLAKE2b-256 checksum How to use checksums |
a5faf16607d46e79bed41e6f45c61ab701614a4331c8e104b8d710d1b6ba0869
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
DepHell/0.8.3
|