-
Notifications
You must be signed in to change notification settings - Fork 11
infinite module recursion when trying to add black wrapper script #17
Comments
It may be a collision on your If the |
Here's the contents of my
I'm actually not able to print out the path, since it seems like the the entry_point script is not being created and the i.e. It's worth noting that I'm on |
This should be easy enough to reproduce on my end, so I'll give it a shot and see what happens. |
So there are two parts to this, one is whether we can automatically add a binary shim for entry points as described in the ticket above. The other is why the custom shim fails. I have managed to get the example working with: py_binary(
name = "black",
srcs = ["main.py"],
main = "main.py",
deps = [
requirement("black"),
]
) I believe the issue only exists when the wrapper script is called It seems that this is a reoccurrence of bazelbuild/bazel#9239. The workspace directory should not be on sys.path and yet is. This is reproducible on my machine by having a trivial py_binary containing
Interestingly |
That is interesting. So |
It seems to be an open issue bazelbuild/bazel#7091. The ticket above (bazelbuild/bazel#9239) fixes the sys.path specifically for the Bazel runfiles, it doesn't look as if the fix gets propagated down to the users scripts. bazelbuild/bazel#7091 (comment):
Should note, even if this gets fixed, there would still be a naming collision on black due to
both being on the path. However, since external dependencies get listed first it would appear to work. I think that the correct solution here is to rename the wrapper file. Work to auto-generate the wrapper will be tracked in #18. I'll close this off for now since it is tracked upstream. |
Good morning,
I'm trying to use
rules_python_external
and define black==19.10b0 as a dependency. There doesn't seem to be support inbazel
for handling wheels that rely onentry_point
definitions for their CLI interface, so I created my own. However, when trying to call off topatched_main
it seems as though the import tree for black is incorrect.BUILD file
black.py
the
black
module seems to be the only importable attribute in the py_library.The text was updated successfully, but these errors were encountered: