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

Port to use bzlmod and hermetic Python #76

Merged
merged 1 commit into from
May 20, 2024

Conversation

jwnimmer-tri
Copy link
Contributor

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

See https://bazel.build/external/module for docs about bzlmod. The WORKSPACE mechanism in Bazel will be deprecated around the end of this year, and removed about a year (or a little more) after that. Porting some of our smaller projects like this one to bzlmod is good practice for working the same on Drake (RobotLocomotion/drake#20731).

Closes #67.


Respell WORKSPACE.bazel into MODULE.bazel + WORKSPACE.bzlmod. For now, this means that our skylark external dependencies (like rules_python) are not upgraded by tools/upgrade.sh -- there's a TODO instead. (My expectation is that after this PR lands, the @renovatebot will automatically handle it for us.)

Switch from the Ubuntu Python interpreter to a Bazel one (downloaded as an external). Since any given version of Blender only works with one specific version of CPython, this will make it easier to stay in sync long-term. This also lets us drop the unittest_path_cleaner hack to avoid test pollution from Ubuntu libraries.

Switch to using a pip() helper macro to specify the pip deps for our programs. The old long-hand spellings don't work with bzlmod.

Switch to rules_python runfiles instead of bazel_tools runfiles (ala RobotLocomotion/drake#21331).

Add test/BUILD.bazel as a sub-package; writing out all of the test rules in the top-level BUILD.bazel was too much clutter.


This change is Reviewable

@jwnimmer-tri
Copy link
Contributor Author

+@zachfang and +@SeanCurtis-TRI for review, please.

\CC @rpoyner-tri FYI

Respell WORKSPACE.bazel into MODULE.bazel + WORKSPACE.bzlmod. For now,
this means that our skylark external dependencies (like rules_python)
are not upgraded by tools/upgrade.sh -- there's a TODO instead.

Switch from the Ubuntu Python interpreter to a Bazel one (downloaded
as an external). Since any given version of Blender only works with
one specific version of CPython, this will make it easier to stay in
sync long-term. This also lets us drop the unittest_path_cleaner
hack to avoid test pollution from Ubuntu libraries.

Switch to using a pip() helper macro to specify the pip deps for our
programs. The old long-hand spellings don't work with bzlmod.

Switch to rules_python runfiles instead of bazel_tools runfiles.

Add test/BUILD.bazel as a sub-package; writing out all of the test
rules in the top-level BUILD.bazel was too much clutter.
Copy link

@rpoyner-tri rpoyner-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 2 of 17 files at r1.
Reviewable status: LGTM missing from assignees SeanCurtis-TRI,zachfang (waiting on @SeanCurtis-TRI and @zachfang)

Copy link
Contributor

@zachfang zachfang left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 17 of 17 files at r1.
Reviewable status: LGTM missing from assignee SeanCurtis-TRI (waiting on @SeanCurtis-TRI)

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: The changes seem consistent with the documentation, but the bazel details go beyond my level of comprehension. So, take the stamp for what it's worth.

Reviewed 17 of 17 files at r1, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees SeanCurtis-TRI,zachfang (waiting on @jwnimmer-tri)

@jwnimmer-tri
Copy link
Contributor Author

The hope is that in a pinch, others besides me have enough familiarity with the build (by having read these PRs and checked them for clarity) to fix things that crop up.

@jwnimmer-tri jwnimmer-tri merged commit bc53c48 into RobotLocomotion:main May 20, 2024
2 checks passed
@jwnimmer-tri jwnimmer-tri deleted the bzlmod branch May 20, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to bzlmod
4 participants