From 1c507913b694d69b36b5ab66bd3b3276b425d35d Mon Sep 17 00:00:00 2001 From: Ryan Kuester Date: Sat, 21 Jun 2025 17:28:19 -0500 Subject: [PATCH] feat(python): enable compression in the official pypi package Enable TFLM compression support in the official Python package builds by adding --//:with_compression=true to the bazel commands in pypi_build.sh. This ensures that: - Users who install tflite_micro from PyPI can use compressed models - The compression module functionality is available out of the box - Both the wheel build and tests run with compression enabled The Python package is primarily used for testing and development on desktop/server systems, not on embedded targets. There's no benefit to disabling compression support to save a few kilobytes when the package runs on machines with gigabytes of RAM. Enabling compression by default provides a better developer experience without any practical downside. BUG=#3125 --- python/tflite_micro/pypi_build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/tflite_micro/pypi_build.sh b/python/tflite_micro/pypi_build.sh index 05812257721..166071f783b 100755 --- a/python/tflite_micro/pypi_build.sh +++ b/python/tflite_micro/pypi_build.sh @@ -101,13 +101,15 @@ docker run \ } # Build the wheel via bazel, using the Python compatibility tag matching the - # build environment. + # build environment. Enable compression support for the official package. call_bazel build //python/tflite_micro:whl.dist \ - --//python/tflite_micro:compatibility_tag=\$PY_COMPATIBILITY + --//python/tflite_micro:compatibility_tag=\$PY_COMPATIBILITY \ + --//:with_compression=true # Test, in the container environment. call_bazel test //python/tflite_micro:whl_test \ - --//python/tflite_micro:compatibility_tag=\$PY_COMPATIBILITY + --//python/tflite_micro:compatibility_tag=\$PY_COMPATIBILITY \ + --//:with_compression=true EOF # Make the output directory tree writable so it can be removed easily by the