Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --project locking and PEX building. #2455

Merged
merged 4 commits into from
Jul 6, 2024

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Jul 5, 2024

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.

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 pex-tool#2412.
Previously timings could be dropped.
Previously, if a PEX was built and run on the same machine, later PEXes
built from the same wheels would have `.pyc` from prior runs of that
wheel code erroneously included, breaking the `--no-compile` default
as well as reproducibility.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed dropped timings for the new TRACER.timed("Collecting requirements from {count} local {projects}") added to pex/cli/commands/lock.py.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had actually seen this .pyc leak before in scie-pants, but also encountered it in the integration test here comparing PEX files.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@jsirois jsirois marked this pull request as ready for review July 6, 2024 06:02
@jsirois jsirois changed the title Support locking and building local project PEXes. Support --project locking and PEX building. Jul 6, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@jsirois jsirois merged commit 92e3e96 into pex-tool:main Jul 6, 2024
26 checks passed
@jsirois jsirois deleted the issues/2412 branch July 6, 2024 07:00
jsirois added a commit to jsirois/pex that referenced this pull request Jul 6, 2024
jsirois added a commit to jsirois/pex that referenced this pull request Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for pip-compile generated requirements with hashes
2 participants