Skip to content
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

[doc,tools] Adjust imports and libraries in prep for bzlmod #21453

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented May 17, 2024

Re-spell imports to lose the "drake" part of the module namespace. The old spelling of imports is dispreferred and will not work with upcoming bzlmod.

For all Drake Python code, we should be using drake_py_library so that all Drake-specific settings are always in effect. (Earlier in bzlmod porting this was critically important; since then, I've changed some options so that it's less critical but we should anyway follow this hygiene so that we always have a single point of control for our build rules.)

Towards #20731. See #21401 for prior art.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri added priority: low status: single reviewer ok https://drake.mit.edu/reviewable.html release notes: none This pull request should not be mentioned in the release notes labels May 17, 2024
@jwnimmer-tri
Copy link
Collaborator Author

+@SeanCurtis-TRI for both reviews, please (load balancing).

@BetsyMcPhail
Copy link
Contributor

@drake-jenkins-bot mac-arm-ventura-clang-bazel-experimental-release please.

Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:LGTM: (This should be considered midway between a rubberstamp and an actual review.)

Reviewed 41 of 41 files at r1, all commit messages.
Reviewable status: 3 unresolved discussions

a discussion (no related file):
tools/install/dummy/BUILD.bazel still uses py_library over drake_py_library. As the name includes "dummy" I can certainly entertain arguments for it not mattering. But, I'd opt for some explicitly handling (like in tools/jupyter/BUILD.bazel).


a discussion (no related file):
tools/lint/python_lint.bzl has some example code in the documentation referencing py_library instead of drake_py_library. Do we want to update the example?



tools/install/BUILD.bazel line 8 at r1 (raw file):

    "drake_py_unittest",
)
load("//tools/skylark:py.bzl", "py_library")

nit unused

@BetsyMcPhail
Copy link
Contributor

@drake-jenkins-bot mac-arm-ventura-clang-bazel-experimental-release please.

Re-spell imports to lose the "drake" part of the module namespace.
The old spelling of imports is dispreferred and will not work with
upcoming bzlmod.

For all Drake Python code, we should be using drake_py_library so that
all Drake-specific settings are always in effect. (Earlier in bzlmod
porting this was critically important; since then, I've changed some
options so that it's less critical but we should anyway follow this
hygiene so that we always have a single point of control for our build
rules.)
Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 unresolved discussions

a discussion (no related file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…

tools/lint/python_lint.bzl has some example code in the documentation referencing py_library instead of drake_py_library. Do we want to update the example?

No, it's supposed to be docs available for downstream use also. But anyway I've been slowing purging the "Example" snippets from those docs (because they bitrot) so purged now.


a discussion (no related file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…

tools/install/dummy/BUILD.bazel still uses py_library over drake_py_library. As the name includes "dummy" I can certainly entertain arguments for it not mattering. But, I'd opt for some explicitly handling (like in tools/jupyter/BUILD.bazel).

Aha. Good reminder.

When I visited that file while developing this PR, I had thought it was a sample directory for a downstream project, in which case using "drake" macros would be incorrect.

Looking again now, I see it's supposed to be a "pretend to be a really stubby form of Drake itself" project, so we should be using the "drake" macros.


Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee SeanCurtis-TRI(platform)

@jwnimmer-tri jwnimmer-tri merged commit 11571a1 into RobotLocomotion:master May 20, 2024
9 checks passed
@jwnimmer-tri jwnimmer-tri deleted the bzlmod-doctools-import-path branch May 20, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low release notes: none This pull request should not be mentioned in the release notes status: single reviewer ok https://drake.mit.edu/reviewable.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants