Python/PipEnv
PipEnv is an attempt to make Python Pip behave more like Composer (from Php/Laravel).
In other words, this is meant to streamline project package/environment management. You tell PipEnv what packages you care about, and it effectively installs + manages versions (and sub-dependency versions) for you.
This data is stored in files called PipFile
and PipFile.lock
, at your project root.
Official docs can be found at https://docs.pipenv.org/
This page shows quick, basic options for ease of use.
Linux Setup
Before using PipEnv, it's recommended to add some additional settings to the local system environment.
To do this, edit the user's local .bashrc
file (or equivalent) and add the following:
Update terminal path to find PipEnv:
export PATH="$PATH:/home/<username>/.local/bin"
Update PipEnv settings to always use venv folders in project:
export PIPENV_VENV_IN_PROJECT=true
Reminder to restart terminal after saving changes.
Important Commands
Install Commands
Install PipEnv for Mac:
brew install pipenv
Install PipEnv for Linux:
python3 -m pip install --user pipenv
Project Setup Commands
--dev
flag, which tells PipEnv to install optional "dev-packages" to the local Python environment. Aka, those dependencies that were defined in the "development section" of the PipFile.Install current project dependencies to the local Python environment, as listed in PipEnv files:
pipenv sync
Update project dependencies listed in PipEnv files, then install them to the local python environment:
pipenv install
Update a specific dependency (warning - may also update unrelated dependencies):
pipenv update <dependency>