-
Notifications
You must be signed in to change notification settings - Fork 550
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
pip_parse()
does not correctly read *.pth
files?
#2071
Comments
imports
and deps
via package_annotation
imports
and deps
via package_annotation
?
|
in this case, it's missing perhaps it's because there's a $ cd $(bazel info output_base)
$ cat external/pip_deps_rerun_sdk/site-packages/rerun_sdk.pth
rerun_sdk from docs https://docs.python.org/3/library/site.html |
(if this seems like a valid thing, I can |
Thanks for the repro and the logs, this makes it easier to understand. The I think ideally the solution would be to investigate how to make |
imports
and deps
via package_annotation
?pip_parse()
does not correctly read *.pth
files?
sweet, welcome I think simplest way is to assume it's non-executable rules_python/python/private/pypi/generate_whl_library_build_bazel.bzl Lines 85 to 87 in ecad092
would probably need something like |
very loose code: main...EricCousineau-TRI:rules_python:issue-2071 |
This looks like it could work, having such code in whl_library could be a good idea.
If you would like to finish this and submit a PR, feel free to do it. I think the main idea of just reading the pth file in starlark and then appending the imports would be a nice way to do it.
…On 20 July 2024 03:01:02 GMT+09:00, Eric Cousineau ***@***.***> wrote:
very loose code: main...EricCousineau-TRI:rules_python:issue-2071
--
Reply to this email directly or view it on GitHub:
#2071 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Closing this issue as a duplicate of #2156 Any PR to workaround |
With Python 3.12,
With this in mind, I don't think that reading the pth file in starlark and appending the imports would work. It might work for some packages, but not for At our company, we're using a workaround where we create a |
I think the issue is that there can be only one Is |
In this case, import distutils as _distutils In Python 3.11 and earlier, this is an import from the standard library, so we're not really involving
|
I am somewhat thinking that setuptools should be treted in rules_python in a special way. I have no other ideas on how to fix this - maybe we coud have a special BUILD.bazel file for that package and reuse the same setuptools repository everywhere. If the user tries to include it via pip in bzlmod, we could easily handle that. Doing that in workspace may be too much work. Potentially related - #2370 |
🚀 feature request
Relevant Rules
package_annotation()
frompip.bzl
Description
From docs, as of time of writing, you can add
BUILD
content, or add / remove files, but doesn't seem like you can changepy_library(deps, imports)
.For example, rerun.io is an awesome-looking package.
But it doesn't work when using using bazel +
rules_python @ 0.34.0
:https://github.com/EricCousineau-TRI/repro/tree/e084a7434286cf426a71350f79755c7cbab6d6eb/bazel/rules_python_rerun
Seems like either the wheel doesn't declare things s.t.
rules_python
adds./site-packages/rerun_sdk
to the Python path (it only adds./site-packages
).Describe the solution you'd like
For now, would be nice to have something like
Describe alternatives you've considered
For now, will try
package_annotation(..., additive_build_content)
, and include that whenever I usepip("rerun-sdk")
.EDIT: This workaround worked: EricCousineau-TRI/repro@96e1336
The text was updated successfully, but these errors were encountered: