Skip to content

Fix functionality gaps of wheel resolver: support prereleases and all system tags#151

Closed
tm-jdelapuente wants to merge 1 commit intomasterfrom
system-tags-gap
Closed

Fix functionality gaps of wheel resolver: support prereleases and all system tags#151
tm-jdelapuente wants to merge 1 commit intomasterfrom
system-tags-gap

Conversation

@tm-jdelapuente
Copy link
Contributor

Problems

  1. Prereleased wheels aren't being downloaded
  2. Some packages aren't being downloaded because distlib's function that creates tags is less complete than packaging.tags.sys_tags

Solution

  1. Prereleased wheels are downloaded by passing prereleases=True to locator.locate
  2. To use the more complete packaging.tags.sys_tags we create those tags and assign them to locator.wheel_tags

UX change

Since this is OSS it's ideal to give users the ability to stop prereleases from being used. This would give people that work with Please more control over what dependencies get included within their organization.

To do this, the wheel resolver now takes a flag prereleases that is set in .plzconfig under the new PluginConfig "prereleases".

# We're currently hardcoding PyPI but we should consider allowing other
# repositories
locator = distlib.locators.SimpleScrapingLocator(url="https://pypi.org/simple")
locator.wheel_tags = list(itertools.product(interpreter, abi, platform))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where we're setting the locator to use sys_tags instead of the tags that distlib generates internally, which are less complete.

_LOGGER.debug("requirement: %r", requirement)

distribution = locator.locate(requirement)
distribution = locator.locate(requirement=requirement, prereleases=prereleases)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how we get disctlib to download prereleases

return url.endswith(".whl")


def _is_compatible(url: str, tags: typing.List[str]) -> bool:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can remove _is_compatible because distlib already checks for tag compatibility

@tm-jdelapuente tm-jdelapuente deleted the system-tags-gap branch August 20, 2024 12:58
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.

1 participant