-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
bazel_external: Issue from drake
dir being on the Python path, and drake/common/__init__.py
being auto-created
#13320
Comments
drake
is on the Python path, and common/__init__.py
is auto-createddrake
is on the Python path, and drake/common/__init__.py
is auto-created
drake
is on the Python path, and drake/common/__init__.py
is auto-createddrake
being on the Python path,and drake/common/__init__.py
being auto-created
drake
being on the Python path,and drake/common/__init__.py
being auto-createddrake
dir being on the Python path, and drake/common/__init__.py
being auto-created
With the "Issue 1, 2" callouts above, I can understand what's happening and why it causes friction. I think It seems to me the only problem is Issue 1 biting us. To mitigate, we either need to (a) change how bazel python sets up the import path project-wide, or (b) show users how to correctly spell imports in the bazel world. Since (a) seems like a project wide, rcfile-type setting, it's not fixable in Drake anyway. Maybe a prototypical bazelrc in drake-external-examples. However, doing (b) should be easy and sufficient to resolve the question. I think the only action here is to add a |
SGTM. Will submit strawman example. |
Also, for the record, I have one, but it's reeks of "unofficialness": |
Eric is working on the PR for this, so changed assignment. |
The PR RobotLocomotion/drake-external-examples#175 died on the vine. Closing this as "won't fix". Any anyone is interested, they can work on resurrecting that PR. |
This is the more specific version of this comment: #7871 (comment)
From @pvarin's StackOverflow post:
https://stackoverflow.com/q/61802860/7829525
To reproduce, see my updated example:
drake_bazel_external/apps/bar.py
(branch)Issue 1: Repositories are slapped onto
PYTHONPATH
.Issue 2: Autocreated
__init__.py
When running, this is the output that I see: (with
<--
annotations added)Note that
common
should point todrake_external_examples/common/__init__.py
, notdrake/common/__init__.py
.FTR The overall correct decision is to import using the workspace name. Changing:
to
FYI @jwnimmer-tri
The text was updated successfully, but these errors were encountered: