-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
bump-formula-pr: expose update-python-resources CLI flags #13147
bump-formula-pr: expose update-python-resources CLI flags #13147
Conversation
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.
Thanks for the PR! I think I'd like to see this use e.g. new CLI flags rather than undocumented environment variables. Thoughts?
What's the benefits of this over the already existing
|
I should note that this could be done through the Adding support for all of the same flags for including/excluding python extras in the bump formula script would technically work for us. (see followup note on this in #13147 (comment))
I'd say that the main difference between this and the existing These packages aren't direct DVC requirements, they are basically dependencies of dependencies of dependencies. The required version ranges are also specified correctly in the dependency python packages. The issue is that pipgrip crashes when trying to resolve the particular combination of python packages that end up being used in DVC (see the linked pipgrip issue in the first PR comment for specific details). From the DVC maintainer perspective, we see this specifically as a pipgrip issue (and not a DVC requirements/dependency issue), since pip is able to resolve dependencies for DVC without needing to pin or hint any additional package version information. We would prefer not to pin these types of nested dependencies in the homebrew-core
This is a valid point. But given that anyone who wants to bump this formula right now will still end up needing to manually run pipgrip to see where it crashes, find the correct set of hints to feed it, and then edit |
I guess from the DVC maintainer perspective, ideally we just want a solution that won't require manually updating pinned dependency versions in Maybe the best solution here would be to expose the include/exclude extras CLI flags in
This still doesn't address the "make it easy for anyone to bump the given formula" problem, but I'm not sure there's a solution to that for this particular case w/DVC and pipgrip. edit: Actually I just noticed that using |
|
ee0af16
to
3b2b788
Compare
flag "--python-package-name=", | ||
description: "Use the specified <package-name> when finding Python resources for <formula>. "\ | ||
"If no package name is specified, it will be inferred from the formula's stable URL." | ||
comma_array "--python-extra-packages=", | ||
description: "Include these additional Python packages when finding resources." | ||
comma_array "--python-exclude-packages=", | ||
description: "Exclude these Python packages when finding resources." |
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.
Not sure what the preferred flag ordering is here (specifically regarding whether the new args need to be inserted somewhere else in the args list)
Also went with --python-<flag>
naming instead of the original suggested --extra-python-packages
for consistency (python in the middle works for include/exclude but not --package-name
)
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.
Just to check: do you personally need all three of these arguments?
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.
Yes, because PyPI.update_python_resources
only loads the contents of pypi_formula_mappings.json
if none of these flags are specified via the CLI.
brew/Library/Homebrew/utils/pypi.rb
Lines 141 to 143 in ce5cb9b
auto_update_list = formula.tap&.pypi_formula_mappings | |
if auto_update_list.present? && auto_update_list.key?(formula.full_name) && | |
package_name.blank? && extra_packages.blank? && exclude_packages.blank? |
So in order to get the behavior I'm looking for (to build DVC with additional --python-extra-packages
hints to be passed into pipgrip), I have to also specify the package name + excludes via the CLI (even though they are listed in pypi_formula_mappings.json
)
3b2b788
to
e794b91
Compare
Updated this PR to expose the relevant CLI flags in |
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.
One question here. Code looks good!
flag "--python-package-name=", | ||
description: "Use the specified <package-name> when finding Python resources for <formula>. "\ | ||
"If no package name is specified, it will be inferred from the formula's stable URL." | ||
comma_array "--python-extra-packages=", | ||
description: "Include these additional Python packages when finding resources." | ||
comma_array "--python-exclude-packages=", | ||
description: "Exclude these Python packages when finding resources." |
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.
Just to check: do you personally need all three of these arguments?
Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @pmrowla! |
Looks like CI needs to be re-run? The failure is due to GHA rate limiting
|
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Exposes CLI flags from
update-python-resources
so they can be used inbump-formula-pr
:brew update-python-resources --package-name
->brew bump-formula-pr --python-package-name
--extra-packages
->--python-extra-packages
--exclude-packages
->--python-exclude-packages
Original PR changes (outdated)
pipgrip 0.8.0 adds support for the
PIPGRIP_ADDITIONAL_DEPENDENCIES
environment variable which can be used to pass additional dependency information into pipgrip. When using the homebrew dev tools (update-python-resources
andbump-formula-pr
) this cannot be propagated into pipgrip due to the env var filtering (unless you also set the hidden+deprecatedHOMEBREW_NO_ENV_FILTERING
env var).This PR adds an equivalent
HOMEBREW_PIPGRIP_ADDITIONAL_DEPENDENCIES
env var so that it can be passed into pipgrip through the filtering.As to why this is needed, basically pipgrip has problems resolving dependencies for DVC due to misbehaving/broken pypi packages (that we don't have control over). This env var can be used to provide hints for specific versions pipgrip should try in order to successfully resolve the dependencies. See: