-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Adapt mypy bazel rule to work with Bazel 8 #144
Conversation
Currently this script invokes mypy at the `external/{REPO_NAME}/mypy/mypy` path. This was previously valid, but from Bazel 8 onwards it's not valid, and the external repo can no longer be found at that path. The correct path is now `../{REPO_NAME}/mypy/mypy`. More details at bazelbuild/bazel#23574 This change adapts the path to mypy.
Also pin the version in the `examples` dir to prevent it from getting broken by new incompatible upstream versions.
01d516e
to
2315df6
Compare
--nolegacy_external_runfiles
Hi @alexeagle @adzenith, if you have a minute, a review would be welcome on this change :) It should help an internal repo of mine which heavily uses the bazel-mypy-integration ruleset to migrate to Bazel 8 |
@@ -27,7 +22,7 @@ jobs: | |||
- uses: actions/checkout@v4 | |||
- uses: p0deje/setup-bazel@0.9.0 | |||
with: | |||
bazelrc: common --announce_rc --color=yes --enable_bzlmod=${{ matrix.bzlmodEnabled }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine we can do some cleanup in the root module if it's no longer built with WORKSPACE, I'll take that as a follow-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR does 3 things:
--legacy_external_runfiles
to false bazelbuild/bazel#23574 in Bazel 8. As detailed in the linked issue description,$RUNFILES/<main repo>/external/<external repo>/<path>
is removed in favour of$RUNFILES/<external repo>/<path>
. To get to the new external location from the<main repo>
path, we just need to go up one directory and the rest of the path remains correct. It might seem a bit hacky, but I am not aware of an API making it easier to get to this new location. This wiki page also illustrates the tree change quite well https://github.com/bazelbuild/bazel/wiki/Updating-the-runfiles-tree-structure: