Python pipenv
From wikinotes
pipenv behaves similar to ruby bundler.
A python virtualenv is described with requirements in a pipfile, and resolved packages are recorded to a pipfile.lock
Each virtualenv has it's own independent set of packages (even if same package versions are shared between two pipenv projects).
Documentation
github https://github.com/pypa/pipenv pipfile github https://github.com/pypa/pipfile official docs https://docs.pipenv.org/
Tutorials
realpython https://realpython.com/pipenv-guide/
Locations
~/.local/share/virtualenvs/*
pipenv managed virtualenvs ${PROJECT}/Pipfile
environment requirements ${PROJECT}/Pipfile.lock
frozen requirements
Install
pip install pipenv pacman -S python-pipenv
Usage
Locations
pipenv --venv # show project's virtualenv dir pipenv --where # show project's rootdirNew Projects
Project Setup
pipenv install # install Pipfile requirements (build Pipfile if requirements.txt present) pipenv install --dev # install Pipfiles dev-packages pipenv install --ignore-pipfile # install Pipfile.lock requirements pipenv --rm # delete virtualenvUsage
pipenv shell # create/enter venv pipenv lock # freeze environment in a Pipfile.lock pipenv run ... # run command within environmentPackage Management
pipenv install pytest --dev # install under [dev-packages] pipenv install PySide2==5.15.2 # install # version request format # requests~=1.2 # mock<4 pipenv lock --requirements > requirements.txt # requirements.txt from pipfile pipenv run pip install pytest # install package into environment, without updating pipfile
Syntax
# ${PROJECT}/Pipfile [[source]] url = 'https://pypi.python.org/simple' verify_ssl = true name = 'pypi' [requires] python_version = '2.7' [packages] recommonmark = "*" requests = { extras = ['socks'] } records = '>0.5.0' django = { git = 'https://github.com/django/django.git', ref = '1.11.4', editable = true } "e682b37" = {file = "https://github.com/divio/django-cms/archive/release/3.4.x.zip"} "e1839a8" = {path = ".", editable = true} pywinusb = { version = "*", os_name = "=='nt'", index="pypi"} [dev-packages] nose = '*' unittest2 = {version = ">=1.0,<3.0", markers="python_version < '2.7.9' or (python_version >= '3.0' and python_version < '3.4')"}