pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.53k stars 259 forks source link

Support `--project` locking and PEX building. #2455

Closed jsirois closed 3 months ago

jsirois commented 3 months ago

Although Pex already supported local project requirements, they worked like any other requirement and were included in locks. In the typical case, a project would rather maintain a lock of its third party requirements separate from itself. For projects that used requirement files to record their unlocked dependencies, -r could be used instead of locking the local project. For projects that recorded their dependencies in a setup.py, setup.cfg or pyproject.toml, the dependency information needed to be extracted from those files to create a lock that did not lock the project code itself. Just as bad, when constructing a PEX the source code layout of the project recorded in those same project files needed to be replicated in some combination of -D, -P and -M since resolving from a lock required all projects needed by the PEX were represented in the lock.

With the addition of the new --project option to PEX builds and pex3 lock {create,sync}, a project's dependencies and source code layout can be referenced from their canonical home in the project configuration files.

Fixes #2412.