Pipenv: basic overview

Pipenv essentially acts as a replacement for pip. It introduces 2 "new" files: Pipfile ("replacement" for requirements.txt) and Pipfile.lock which ensures that builds are deterministic.

Pipenv uses pip and virtualenv under the hood but simplifies their usage with a single command line interface.

First, let’s install it:

$ pip install pipenv

Now let's create a new project:

$ pipenv --python 3.6

This will create a virutalenv for this project and Pipfile file.

Next, we add some dependencies:

$ pipenv install [package]

Once you are done installing packages you need to lock the dependencies:

$ pipenv lock

This will create the Pipfile.lock file where all package names, together with its version and a list of its own dependencies are frozen. You should not manually edit this file.

To uninstall a package simply type:

$ pipenv uninstall [package]

Or to uninstall everything from the env type:

$ pipenv uninstall --all

And to remove the virtualenv type:

$ pipenv --rm

Check for security vulnerabilities (and PEP 508 requirements) in your environment:

$ pipenv check


If you want to install packages directly from github:

# install specific tag
$ pipenv install git+https://github.com/karantan/ansible@v2.6.0.1#egg=ansible

# install from latest master
$ pipenv install git+https://github.com/karantan/ansible#egg=ansible



Further reading:

Leave a Reply

Your email address will not be published.