Gangmax Blog

pipenv

From here.

“pipenv” is a Python environment tool which combines “virtualenv” and “pip” and simplifies the dependencies management.

The problems that Pipenv seeks to solve are multi-faceted:

  1. You no longer need to use pip and virtualenv separately. They work together.

  2. Managing a requirements.txt file can be problematic, so Pipenv uses the upcoming Pipfile and Pipfile.lock instead, which is superior for basic use cases.

  3. Hashes are used everywhere, always. Security. Automatically expose security vulnerabilities.

  4. Give you insight into your dependency graph (e.g. $ pipenv graph).

  5. Streamline development workflow by loading .env files.

Here is some example commands.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Create directory.
mkdir watermark
# Enter directory.
cd watermark
# Set the Python version for the current project.
pipenv --python 3.6
# Install dependencies.
pipenv install Pillow
# Write the script content.
vi watermark.py
# Run the script.
pipenv run python watermark.py
# Lock the dependencies versions.
pipenv lock
# Enter virtualenv shell.
pipenv shell
# Print dependencies info.
pip freeze
# List all the pip packages of the current virtualenv.
pip list
# Run the script.
python watermark.py
# Exit current virtualenv environment.
exit

More information can be found in the official document here.

Comments