build(bazel): inject tflite_micro shim via tflm_py_* wrappers#3573
Merged
Conversation
veblush
previously approved these changes
May 26, 2026
Contributor
Author
|
It looks like the buildifier in the latest tflm-ci image (as of September 2025) has stronger opinions on the ordering of load statements than did older buildifier versions. I'll fix the ordering, and update my local tools to match CI. |
Python targets in this repository import one another under the "tflite_micro" package namespace, which //:tflite_micro_shim synthesizes at import time. The shim is required under Bzlmod, where the main repository's runfiles root is the fixed name "_main" rather than the module name, so the "tflite_micro" prefix no longer resolves on its own. Every such target therefore had to list //:tflite_micro_shim in its deps, which was repetitive and easy to forget. Add tflm_py_library, tflm_py_test, and tflm_py_binary wrappers in a new //python:py_rules.bzl that inject the shim dependency automatically, following the naming convention of the existing tflm_cc_* wrappers, and document the shim's rationale there. Convert every target that previously listed the shim to the corresponding wrapper and drop the explicit dependency. The dependency graph is unchanged; only the means by which the shim is attached differs.
5281d7f to
002834d
Compare
veblush
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python targets in this repository import one another under the
"tflite_micro" package namespace, which //:tflite_micro_shim synthesizes
at import time. The shim is required under Bzlmod, where the main
repository's runfiles root is the fixed name "_main" rather than the
module name, so the "tflite_micro" prefix no longer resolves on its own.
Every such target therefore had to list //:tflite_micro_shim in its
deps, which was repetitive and easy to forget.
Add tflm_py_library, tflm_py_test, and tflm_py_binary wrappers in a new
//python:py_rules.bzl that inject the shim dependency automatically,
following the naming convention of the existing tflm_cc_* wrappers, and
document the shim's rationale there. Convert every target that
previously listed the shim to the corresponding wrapper and drop the
explicit dependency. The dependency graph is unchanged; only the means
by which the shim is attached differs.
BUG=part of #3128