-
Notifications
You must be signed in to change notification settings - Fork 12
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: implement settings driven download and high level resolver customization #207
feat: implement settings driven download and high level resolver customization #207
Conversation
6ba4bae
to
b1fdf38
Compare
Edit: done |
8e8111d
to
c98eaf0
Compare
2364012
to
c83e0d1
Compare
1dfc9ce
to
79bda31
Compare
Config parsing and handling is getting a bit convoluted. We could look into Pydantic or attrs to do some validation, typing, and nice wrapping for us. I tried dataclasses in PR #241, but that's too limited. InstructLab uses Pydantic, but that's pretty heavy weight. attrs is a bit lighter. PS: In a future PR, let's not delay this PR longer than necessary. |
79bda31
to
0aea9f7
Compare
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 real question and several nits for log messages.
src/fromager/sources.py
Outdated
@@ -141,23 +141,35 @@ def default_download_source( | |||
sdist_server_url: str, | |||
) -> tuple[pathlib.Path, str, str]: | |||
"Download the requirement and return the name of the output path." | |||
url_template = ctx.settings.sdist_download_url(req.name) | |||
rename_to_template = ctx.settings.sdist_local_filename(req.name) | |||
logger.debug(f"{req.name}: loading resolver parameters from settings") |
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.
I'm not sure this log message will help someone debug.
logger.debug(f"{req.name}: loading resolver parameters from settings") |
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.
Well the hope is that it comes right before: https://github.com/python-wheel-build/fromager/pull/207/files#diff-e99a2837a7d36f9f14de5c4b54a1db688c08f148f62b8e3d5cb82937419dbca9R153
I was not able to cleanly combine these two statements hence the separate logs. Another option could be to log settings._get_package_settings
and making that public
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 might be a philosophical difference.
I generally want to log before something that may take some time, so if it looks like the program is "stuck" a user can reason about whether maybe it's just taking a while to compute or download something.
Then I also want to log when non-default behaviors are triggered, like an override is being used (or not).
This message is coming just before a lookup that should be very fast, and the results are logged later. So I think we can drop this message entirely and then fix up the phrasing of the other one and the user will have all the info they need.
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.
Yep we can drop the first log statement. If we want to fix the phrasing of the second log statement to indicate whether a value came from settings or not, then I will have to add additional checks just for that. It won't be as clean. If we want to indicate if it came from settings then I would prefer to do it they way we are discussing below
@dhellmann regarding the logging, I think the way to go might be to log whatever |
How many different places will that function be called? Are we going to log the same info a lot? Does logging all of the package settings at once make it easier to debug than just logging the values that are being used as they are used? |
just in the
It will just log the package setting for the particular requirement we are working with currently. It might be useful so as to not surprise the user when the see a value that they were not expecting |
But it would be all of the settings for that package, right? |
yes, correct |
OK, let's do that. Ask for the settings, if we get any back log something like "found package build configuration settings" and dump all of them. Then later, just report things like "doing X using value Y" and don't report each time whether it's a setting, a CLI value, or the default. |
8b65067
to
8cf56e8
Compare
Done I removed the other log statements which logged the values because the resolver function and the download_url function already log them. I just noticed 2 things as well:
|
No, I don't think so. In that case we're looking at the wheel server we've been given to see if we've already built the wheel we're being asked to download. We only want to find a wheel, and we only want to look at that wheel server.
Yes. The values read from the file and the values from the Requirement both need to be canonicalized before you compare them or use them as keys in a dict. |
fixes #191
fixes #185
fixes #184