Lift fallback for PyPI package names to obtain_file#5159
Lift fallback for PyPI package names to obtain_file#5159Flamefire wants to merge 6 commits intoeasybuilders:developfrom
obtain_file#5159Conversation
a5880fc to
fe7e752
Compare
obtain_file
|
@smoors Are you up for taking a look at this? No rush, it's a bit too late to get this in for EasyBuild v5.3.0... |
|
@smoors can you look into this now that EB 5.3 is released? The changed PyTorch easyconfigs need to be converted to PythonBundle and IIRC the |
smoors
left a comment
There was a problem hiding this comment.
now that the retry is moved to obtain_file, would be good to add a test? also for the download_file function?
| num_dashes = download_filename.count('-') | ||
| if num_dashes >= 2 and any(PYPI_PKG_URL_PATTERN in url for url in source_urls): | ||
| # Last dash is the separator between name and version | ||
| alt_download_filename = download_filename.replace('-', '_', num_dashes - 1) |
There was a problem hiding this comment.
actually, according to the specs, we should also replace '.' with '_'
https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode
not sure if it should already be done in this PR?
|
I confused the 2 PRs: The more important one is #5162 to get the test file. But also getting this one ready. Writing the test might be the worst... |
https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode says that any runs of dashes, dots and underscores should be replaced by a single underscore. Try first with this rule applied, then with only dashes replaced but possibly duplication of underscores and keeping dots, and similar for dots as last resort.
1c3b50a to
69ae7e7
Compare
69ae7e7 to
10c870a
Compare
That was tricky to do. But I noticed an unrelated bug (with progress bars) which I fixed in #5162 Used the same approach now here too: Rebased to latest develop too. |
|
@smoors Do you still want a unit test for It isn't too complicated and the main parts are covered by this and 2 more Missing:
|
Followup to #4943
When the download URLs include a PYPI source and the download filename looks like a pypi source where the package name contains dashes then retry downloading with dashes replaced by underscores.
This is more generic than #4943 as it handles e.g. PythonPackage easyconfigs, not just extensions with defaulted names.
Done in 2 steps for easier checking:
download_fileas aEasyBlockmethod fromobtain_filewithout any significant changesSmall change to dry-run logging as
"extensions typically have custom source URLs specified, only mention first"didn't seem to match behavior so removed the comment and add the URL to the initial message instead of a second oneThis is broader than #4943
obtain_filecalls, especially top-level easyconfig sourcesIssue I had was that at this point we do not know anymore where the (download)filename came from and which template values (for name & version) we should use as extensions temporarily update the easyconfig templates.
Example easyconfig PR that makes use of this: easybuilders/easybuild-easyconfigs#25682