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 specifying a named resolve as the superset in a PexRequirements. #18397
Conversation
This named resolve must be a user resolve defined in [python].resolves. This will allow us to move towards specifying a user resolve as the source to resolve a tool from. We can't use the existing LoadedLockfile superset for this, because we don't have access to the PythonSetup subsystem (which provides the list of resolves) when we construct the PexRequirements for a tool, so we don't know which lockfile the name corresponds to.
@@ -433,26 +437,28 @@ async def _setup_pex_requirements( | |||
pip_resolver_args = [*resolve_config.pex_args(), "--resolver-version", "pip-2020-resolver"] | |||
|
|||
if isinstance(request.requirements, EntireLockfile): | |||
lockfile = await Get(LoadedLockfile, LoadedLockfileRequest(request.requirements.lockfile)) | |||
loaded_lockfile = await Get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rename is good for clarity, but was also necessary to avoid a mypy error, since we reuse this var name below.
# A named resolve for a "user lockfile". | ||
# Soon to be the only kind of lockfile, as this class will help | ||
# get rid of the "tool lockfile" concept. | ||
name: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After we get rid of tool lockfiles we may be able to pare the lockfile-related types (Resolve, ChosenPythonResolve, Lockfile, LoadedLockfileRequest, LoadedLockfile, EntireLockfile) down substantially.
@@ -608,7 +619,7 @@ async def build_pex( | |||
) | |||
|
|||
|
|||
def _build_pex_description(request: PexRequest) -> str: | |||
def _build_pex_description(request: PexRequest, resolve_to_lockfile: dict[str, str]) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _build_pex_description(request: PexRequest, resolve_to_lockfile: dict[str, str]) -> str: | |
def _build_pex_description(request: PexRequest, resolve_to_lockfile: Mapping[str, str]) -> str: |
This named resolve must be a user resolve defined in [python].resolves.
This will allow us to move towards specifying a user resolve as the source to resolve a tool from. We can't use the existing LoadedLockfile superset for this, because we don't have access to the PythonSetup subsystem (which provides the list of resolves) when we construct the PexRequirements for a tool, so we don't know which lockfile the name corresponds to.