Pipfile
[requires] python_version = "3.9"
If you’ve spent any significant time in the Python ecosystem, you’re likely familiar with the requirements.txt file. For years, it was the gold standard for tracking packages. But as applications grew more complex, the limitations of requirements files—like "dependency hell" and the lack of separation between development and production environments—became clear. Enter the .
A is a configuration file used by the Pipenv tool to manage project dependencies. Unlike the flat list found in a requirements.txt , a Pipfile is structured into sections, allowing you to clearly define where packages should be installed from and whether they are required for the application to run or just for development. Pipfile
[12†L22-L35][11†L22-L32]
Check your Pipfile now. You'll see pytest = "*" under [dev-packages] . [requires] python_version = "3
One of the most compelling reasons to adopt Pipfile and Pipfile.lock is the level of certainty they bring to production deployments.
To add a package only for development (like pytest or black ), use the --dev flag: pipenv install --dev Use code with caution. Working with Pipfile.lock Enter the
TOML is far easier to read and edit manually than a massive list of pinned versions. Common Pipfile Workflows pipenv install
package = "*" # Latest version package = "==1.2.3" # Exact version package = ">=1.0,<2.0" # Version range package = "~=1.2.3" # Compatible release (>=1.2.3, <1.3.0) package = git = "https://github.com/user/repo.git" package = editable = true, path = "./local-lib"
The Python packaging landscape has evolved significantly, with tools like Poetry and PDM offering alternative approaches. However, Pipfile remains a solid choice for many teams—particularly those who want a straightforward upgrade from the traditional requirements.txt workflow without adopting an entirely new project structure.
Notice the output: Creating a virtualenv for this project... and Adding requests to Pipfile's [packages]...
