Skip to content

What is a lockfile?

A lockfile is a text file enumerating the specific version of every dependency used by a project; it serves as a contract that guarantees reproducible environments across different systems and time periods.

A lockfile might record:

  • Exact versions of all direct and transitive dependencies
  • Cryptographic hashes to verify package integrity
  • Platform-specific requirements and constraints
  • Metadata about how dependencies were resolved

This creates a “single source of truth” for project dependencies that can be reliably reproduced.

The Python ecosystem has lacked standardized lockfile support. Different tools developed their own lockfile formats:

Note

In March 2025, PEP 751 was accepted, which defines a standard format for lockfiles in the Python ecosystem. More tools will likely adopt this standard.

Learn More

Get Python tooling updates

Subscribe to the newsletter
Last updated on

Please submit corrections and feedback...