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

fix: Don't require default Python version for pip hubs #1344

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

rickeylev
Copy link
Contributor

This fixes the issue where a sub-module was required to always have a pip.parse() call configured for the default Python version if it used any pip.parse() call. Such a
requirement puts sub-modules in an impossible situation:

  • If they don't have the default version, they'll get an error.
  • If they register the default version, but also register a specific version,
    they'll potentially cause an error if a root module changes the default to
    match their specific version (because two pip.parse() calls for the same version
    are made, which is an error).

The requirement to have the default version registered for a pip hub was only present to satisfy the whl_library_alias repository rule, which needed a Python version to map //conditions:default to.

To fix, the whl_library_alias rule's default_version arg is made optional. When None is passed, the //conditions:default condition is replaced with a no_match_error setting. This prevents the pip hub from being used with the version-unaware rules, but that makes sense: no wheels were setup for that version, so it's not like there is something that
can be used anyways.

Fixes #1320

@rickeylev rickeylev force-pushed the pip.without.default.python branch 5 times, most recently from 6dabe02 to e52e34c Compare July 27, 2023 16:07
This fixes the issue where a sub-module was required to always have
a pip.parse() call configured for the default Python version if they
used any pip.parse() call. Such a requirement puts sub-modules in an
impossible situation: If they don't have the default version, they'll
get an error. If they register the default version, but also register
a specific version, they'll potentially cause an error if a root module
changes the default to match their specific version (becaues two
pip.parse() calls for the same version are made).

The requirement to have the default version registered for a pip hub was
only present to satisfy the `whl_library_alias` repository rule, which
needed a Ptyhon version to map `//conditions:default` to.

To fix, the `whl_library_alias` rule's `default_version` arg is made
optional. When None is passed, the `//condiitions:default` condition
is replaced with a `no_match_error` setting. This prevents the pip hub
from being used with the version-unaware rules, but that makes sense: no
wheels were setup for that version, so it's not like there is something
that can be used anyways.

Fixes bazelbuild#1320
@rickeylev
Copy link
Contributor Author

OK, CI is happy now. PTAL

Copy link
Collaborator

@chrislovecnm chrislovecnm left a comment

Choose a reason for hiding this comment

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

Lgtm

@chrislovecnm chrislovecnm added this pull request to the merge queue Jul 31, 2023
Merged via the queue into bazelbuild:main with commit afc40f0 Jul 31, 2023
2 checks passed
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.

Don't require a pip.parse call for the default python version
2 participants