Skip to content

Transition OSS Python dependencies and CI builds to hermetic Python. - #1566

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_997953043
Open

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_997953043

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Transition OSS Python dependencies and CI builds to hermetic Python.

Open-source builds and CI pipelines previously relied on legacy @pypi_<pkg>//:pkg repository targets, @release_or_nightly workspace rules, and host-installed Python packages (pip install) before invoking Bazel. With the migration to rules_python hermetic Python toolchains, Bazel resolves Python interpreter versions and wheel dependencies directly via requirements.txt lockfiles and @pypi//<pkg>:pkg targets, making host-level package installation and legacy workspace dependencies redundant and error-prone.

Migrate OSS Python dependency rewrites and oss_scripts/pip_package/BUILD targets to @pypi//<pkg>:pkg, remove the obsolete extra_py_deps helper and @org_tensorflow_datasets workspace archive, and declare explicit test dependencies in BUILD targets. Update oss_scripts/configure.sh and py_deps_profile.bzl to persist HERMETIC_PYTHON_VERSION, IS_NIGHTLY, and TF_VERSION into .bazelrc, re-evaluate the repository rule when environment variables change, and pin tensorflow==<TF_VERSION> (including --pre support for release candidates) when re-locking requirements, while simplifying presubmit, release, and Docker scripts to pass HERMETIC_PYTHON_VERSION instead of managing host virtual environments. Additionally, tag benchmark targets with benchmark-test and filter them out during bazel test so Python 3.12+ test runners do not fail on empty TestCase suites, ensure rules_ml_toolchain overrides tf_workspace0() in the same WORKSPACE evaluation chunk, and read only the first line of .bazelversion in run_tests.sh.

@copybara-service
copybara-service Bot force-pushed the test_997953043 branch 14 times, most recently from 4a19544 to bef9fbd Compare October 14, 2026 17:11
Open-source builds and CI pipelines previously relied on legacy `@pypi_<pkg>//:pkg` repository targets, `@release_or_nightly` workspace rules, and host-installed Python packages (`pip install`) before invoking Bazel. With the migration to `rules_python` hermetic Python toolchains, Bazel resolves Python interpreter versions and wheel dependencies directly via `requirements.txt` lockfiles and `@pypi//<pkg>:pkg` targets, making host-level package installation and legacy workspace dependencies redundant and error-prone.

Migrate OSS Python dependency rewrites and `oss_scripts/pip_package/BUILD` targets to `@pypi//<pkg>:pkg`, remove the obsolete `extra_py_deps` helper and `@org_tensorflow_datasets` workspace archive, and declare explicit test dependencies in `BUILD` targets. Update `oss_scripts/configure.sh` and `py_deps_profile.bzl` to persist `HERMETIC_PYTHON_VERSION`, `IS_NIGHTLY`, and `TF_VERSION` into `.bazelrc`, re-evaluate the repository rule when environment variables change, and pin `tensorflow==<TF_VERSION>` (including `--pre` support for release candidates) when re-locking requirements, while simplifying presubmit, release, and Docker scripts to pass `HERMETIC_PYTHON_VERSION` instead of managing host virtual environments. Additionally, tag benchmark targets with `benchmark-test` and filter them out during `bazel test` so Python 3.12+ test runners do not fail on empty `TestCase` suites, ensure `rules_ml_toolchain` overrides `tf_workspace0()` in the same `WORKSPACE` evaluation chunk, and read only the first line of `.bazelversion` in `run_tests.sh`.

PiperOrigin-RevId: 997953043

This branch has not been deployed

No deployments
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.

1 participant