-
Notifications
You must be signed in to change notification settings - Fork 569
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
feat(config_settings): allow matching minor version of python_version flag #1555
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7de7189
feat(config_settings): accept minor versions of Python in `python_ver…
dizzy57 459f010
Merge remote-tracking branch 'upstream/main' into minor_version_in_flag
rickeylev 768417c
generate fewer settings to match across versions
rickeylev 28d950f
rename test file to be consistent, expand test cases
rickeylev f76a5d5
fix bug with repeated allowed values, add note about default value
rickeylev 497123e
update changelog to better reflect feature added
rickeylev b943bc8
fix lint errors
rickeylev 8bcdd00
dont accept minor version as flag value, add missing import in tests
rickeylev 997d37c
alias config group for better ux; fix typo
rickeylev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Using
build_setting_default = python_versions[0]
here looks like a minor bug, BTW.It enables a config setting, and if user manages to configure a toolchain that matches this full version, this toolchain will be selected by default, instead of the one marked by the
is_default
attr inpython.toolchain(...)
.I think a better approach would be to have something like
build_setting_default = "default"
andvalues = ["default"] + allowed_flag_values
passed to thestring_flag(...)
.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.
"default" is a bit overloaded here.
What python.toolchain's
is_default=True
affects is what//conditions:default
points to, essentially. If that is hit, it basically means either the version-unaware rules are being used, or there is no matching version-aware toolchain configured.The
build_setting_default
value here affects what the version-aware rules use if there isn't something overriding the value (i.e. command line flag, or the target-specific override).I agree that it would be best if the version set with
is_default=True
in the module config should match what this flag defaults to. I think this is possible? By putting the value in a generated repo and loading it here, similar to how rules_python_internal works. But lets have that as part of a separate PR.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.
Added a comment to note this