Pipfile [ PREMIUM — Edition ]
Pipfile is a TOML-formatted file introduced by the Python Packaging Authority (via the pipenv project) to replace the traditional requirements.txt for application dependency declaration. It aims to be more human-friendly and to separate application/runtime dependencies from development-only tooling.
Need Windows vs. Linux packages? Use environment markers:
pipenv install "pywin32 ; sys_platform == 'win32'"
The Pipfile will store the marker, ensuring your code stays cross-platform. Pipfile
You can configure sources for dependencies, allowing for private package repositories.
[source]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
pipenv remove requests
This removes the entry from the Pipfile and uninstalls the package from your environment. Crucially, it triggers a re-generation of the lock file. Pipfile is a TOML-formatted file introduced by the
This section is a game-changer. In the requirements.txt world, developers often manage a requirements-dev.txt manually, which imports requirements.txt. With a Pipfile, you keep them separate but in the same file. Tools like pytest, black, mypy, and sphinx go here. When you deploy to production, you run pipenv install --deploy — which ignores dev-packages entirely, resulting in a leaner, safer container image.
You might be wondering: "Isn't pyproject.toml the new standard?" Yes. PEP 621 now standardizes dependencies within pyproject.toml. Tools like Poetry, Flit, and PDM already use pyproject.toml natively. The Pipfile will store the marker, ensuring your
Where does this leave Pipfile? There is active discussion about Pipenv migrating to read/write pyproject.toml directly. In fact, Pipenv can now read a [project] table from pyproject.toml.
Recommendation:
Pipfiles offer a more structured and comprehensive approach to managing Python project dependencies compared to traditional requirements.txt files. With features like dependency groups, hashes for security, and consistent dependency resolution through Pipfile.lock, Pipfiles are an excellent choice for modern Python projects.
cat Pipfile