Pipenv

1 min read python, packaging

Written in 2019. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/pipenv-playground.

learn pipenv

Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a first-class citizen, in our world.

It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever-important Pipfile.lock, which is used to produce deterministic builds.

Usage

# install
pip3 install pipenv

# create directory
mkdir pipenv-playground
cd pipenv-playground

# install dependency
pipenv install requests

# write some code that uses the dependency
touch main.py

# run it using the created virtualenv
pipenv run python main.py

# can also specify `python3` explicitly
pipenv run python3 main.py

# try with jupyter notebook
cd ..
mkdir jupyter-notebook-playground
cd jupyter-notebook-playground
pipenv install jupyter
pipenv run jupyter notebook

# try with jupyterlab
pipenv install jupyterlab
pipenv run jupyter lab

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.