Use Pipfile

Last modified: 08 March 2021

Pipfile is the dedicated file used by the Pipenv virtual environment to manage project dependencies. This file is essential for using Pipenv. When you create a Pipenv environment either for a new or an existing project, the Pipfile is generated automatically. The file is added to the current project, you can see it in the Project tool window. Similarly, when you open a project with a Pipfile file in PyCharm for the very first time, the Pipenv virtual environment is configured automatically.

Consider a task of creating a list of dependencies from scratch.

PyCharm tracks if any of the requirements listed in Pipfile are not met and suggests that you apply the affected dependencies.

You might have noticed that along with Pipfile, the Pipfile.lock file takes the key important role in managing pipenv project requirements. Each time you execute either pipenv lock or pipenv update, the current snapshot of the virtual environment is taken. Examine the following fragment:

a fragment of the Pipfile.lock

The file has recorded the exact versions of the packages that were installed for the project. It also has generated the hash codes to facilitate secure deployment of your application. When you're downloading dependencies from an untrusted source, the hash codes are used to ensure that the project files are trusted.