Commit graph

6 commits

Author SHA1 Message Date
Esun Kim
183da3e302
Typo in code (#3447)
* Typo in code

* Format
2026-02-11 20:34:42 +00:00
Esun Kim
0e7af97a6d
[CI] windows 2 (#3334)
* Fix more

* More fix to go
2026-01-24 11:08:09 -08:00
Ryan Kuester
70955d09f7
feat(pypi): add support for Python 3.12 and 3.13 (#3211)
Add build configuration for Python 3.12 and 3.13 to the PyPI package.
Update the BUILD file with new compatibility tags and config settings,
extend pypi_build.sh to accept the new Python versions, and add build
steps in the GitHub Actions workflow.

Fix whl_test.sh to rename wheels with unstamped variable names before
pip installation. The py_wheel rule creates the base :whl target with
literal stamp variables like _BUILD_EMBED_LABEL_ in the filename for
Bazel caching purposes. Pip 25.x, which ships with Python 3.12+,
strictly validates wheel filenames and rejects these as invalid version
specifiers. Use sed to replace the unstamped variables with a valid
placeholder version (0.0.0) for testing purposes.

Python 3.14 support is not included because Python 3.14 has not yet
been released (scheduled for October 2025).

Fixes: #3186

Co-authored-by: Esun Kim <veblush@google.com>
2025-10-08 09:54:06 -07:00
Ryan Kuester
9f409bb8f9
feat(python): enable compression in the official pypi package (#3145)
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
2025-08-04 18:26:52 +00:00
Ryan Kuester
cdf028c7e3
fix(pypi): pass some env v'bles through during containerized whl build (#2258)
Pass a few environmental variables into the bazel build and test of the
tflite_micro package whl during the containerized build for PyPI. By default,
bazel cleans the environment.

Recent changes (presumably) to the package wrapt, installed as a dependency of
the package tensorflow, cause the containerized build of the package
tflite_micro for PyPI targeting Python 3.11 to fail. During wrapt's
installation, setuptools calls pathlib to determine the user's home directory.
pathlib tries HOME in the environment, but falls back on reading the Unix
password database for itself if necessary. This fallback is why
non-containerized environments don't exhibit the failure despite bazel cleaning
HOME from the environment. In the PyPI build container, however, the password
database doesn't contain the invoking user, and pathlib's fallback fails.

To fix, set HOME and pass it through to the action environment of the bazel
build and test. Also pass through a couple of other variables which were also
intended to affect the build and test (in minor ways, such as cache location
and cleaning up a warning).

BUG=fixes #2257
2023-10-02 16:42:47 +00:00
Ryan Kuester
e0e052dc7b
feat(py): add scripts for building and uploading to PyPI (#2236)
Add mechanism and scripts for building and uploading the Python distribution
package `tflite_micro` to PyPI. These scripts are intended mainly for use by CI
when generating packages for distribution via for PyPI, and won't be used by
most developers. Building a package for local use is still done via a normal
Bazel build.

Heavily comment the scripts with rationale and technical details of the
implementation.

Make significant updates to python/tflite_micro/README.md which explain
building, installing, and uploading the package to PyPI. Leave some cleanup of
the existing text for later.

Add a build setting `--//python/tflite_micro:compatibility_tag` for setting
:whl's platform compatibility tag. Unfortunately, it cannot derived
automatically from the execution environment by the current implementation of
@rules_python.

BUG=part of #1484
2023-09-20 21:23:56 +00:00