Python’s ecosystems now have a standardized lock file format called pyproject.lock (or pylock.toml) defined by PEP 751. This was formally adopted after the proposal was accepted. By Sarah Gooding.
The main goal is improved reproducible environments, especially in CI/CD and deployment. It addresses past issues with fragmented tooling using formats like requirements.txt. The new format aims to be:
- Tool-agnostic: Suitable for any installer.
- Machine-generated but human-readable.
- Secure: Mandatory file hashes for verification, unlike optional requirements.txt hashes.
pylock.toml records exact package versions, file hashes, sizes, download locations (wheel/sdist), platform constraints, extras, and dependency groups. This allows installers to perform installs predictably without needing complex resolution each time.
The adoption standardizes lock files across tools like Poetry, PDM, or uv that generate them (lockers) and any tool that consumes them (installers). It enhances supply chain security by providing verifiable details about package sources and upload times. This is expected to improve reliability and become a key feature for packaging tools in the future. Good read!
[Read More]