-
-
Notifications
You must be signed in to change notification settings - Fork 591
Regression (1.4.0-rc0) | Transient python pypi deps not working #2796
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
Comments
That should be fine. How requirements.txt is generated shouldn't matter, just the content of requirements.txt itself. Can you post a e.g. github gist of your requirements.txt? If it has env markers in it, that might be relevant. |
@rickeylev no env markers are in the requirements file. Only Would you still like the full requirements file? |
Yeah, might as well, if that's ok, just in case it's relevant (ignas won't be back online for many hours, so it might save a long cycle of q/a) |
ah i missed this issue and made a repro case #2805 |
the problem is this logic: https://github.com/bazelbuild/rules_python/blob/c981569cc89c76eb57a78f0bbc47f1566211c924/python/private/pypi/whl_metadata.bzl#L55-L58 in my example the license text contains empty lines:
but the metadata continues afterwards |
The lines in between aren't actually blank, so I wonder if the solution is just to remove the |
here's a potential fix #2806 for reference the previous implementation didn't have this bug because it just overparsed and ignored the end of the header https://github.com/bazelbuild/rules_python/blob/aa0d16c1463e4e26f6ed633ae83d9785a2ea9dfa/tools/wheelmaker.py#L572 |
Skimming the metadata spec, I'm not finding much specified about multi-line headers. https://packaging.python.org/en/latest/specifications/core-metadata For Description, it mandates "7 spaces, then pipe". That isn't specified for License, though. I don't see any general advice for multi-line stuff, either. The code says it treates the first blank line as the end of a header, but I don't see that in the spec, either. Is that a de-facto thing? |
I found that UV appears to use mailparse to parse this, for reference |
alternatively we could just not break. if something has |
I found this in one of the earlier peps: https://peps.python.org/pep-0566/#description
I'm thinking that an empty line vs whitespace-only line are semantically distinct in the METADATA format. Empty line means "end of all headers, what follows is the content of the description header". whitespace-only means...I guess an empty line in the current header? @groodt would you happen to know the packaging trivia here? |
@aignas @rickeylev here's the full requirements hash file & without hashes. https://gist.github.com/JeroenSchmidt/cd768cb9cfadb8b784274f41d9dd3843 |
Yes, its described in Core Metadata here: https://packaging.python.org/en/latest/specifications/core-metadata/ We need support for multiple lines correct because it's actually a format from email headers 😊 Multiple lines and paragraphs are common in Description and License for certain. |
I looked at #2806 once more and I think it would be better to just parse the whole file for |
Hmmm, looking at the whitespace in https://pypi-browser.org/package/pytest-xdist/pytest_xdist-3.6.1-py3-none-any.whl/pytest_xdist-3.6.1.dist-info/METADATA makes me think that what @keith has submitted maybe will be just as good. Let's go with that for now and then let's reopen this if we have further problems. EDIT: I see that |
The wheel `METADATA` parsing implemented in 1.4 missed the fact that whitespace is significant and sometimes License is included inline in the `METADATA` file itself. This change ensures that we stop parsing the `METADATA` file only on first completely empty line. Fixes #2796 --------- Co-authored-by: Ignas Anikevicius <[email protected]>
The wheel `METADATA` parsing implemented in 1.4 missed the fact that whitespace is significant and sometimes License is included inline in the `METADATA` file itself. This change ensures that we stop parsing the `METADATA` file only on first completely empty line. Fixes #2796 --------- Co-authored-by: Ignas Anikevicius <[email protected]> (cherry picked from commit 1d69ad6)
Thanks for the quick fix everyone. The issue looks resolved on my side! |
🐞 bug report
Affected Rule
py_test()
&py_library
Is this a regression?
This problem appears to happen after #2629
Description
Transient dependencies of python packages are not being provided to the test environment.
🔬 Minimal Reproduction
🔥 Exception or Error
🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_python version:
Anything else relevant?
Adding
protobuf
to the BUILD deps results in another transient missing import error whenimport airflow
is called.Lock File Generation
I didn't regenerate the lockfile between testing the changing rules_python versions; but incase it helps I used rules_uv to create the initial lock file with
rules_python==1.3
The text was updated successfully, but these errors were encountered: