Open brandjon opened 5 years ago
The Python rules API consists of the following symbols:
py_library
, py_binary
, py_test
, py_runtime
PyInfo
, PyRuntimeInfo
py_runtime_pair
, find_requirements
:python_version
, :PY2
, :PY3
:toolchain_type
, :py2_interpreter_path
, py3_interpreter_path
:autodetecting_toolchain
, autodetecting_toolchain_nonstrict
The two main goals are to
rules_python
, either by re-exporting them or by copying their definitions; andrules_python
is not used.In the case of 2, the main priority right now is to prohibit access to the native rules, but not necessarily the other symbols right now, since that would in general require implementing new mechanisms for whitelisting.
Update: We will be deferring this until Bazel 2.0. In the meantime, projects can and should continue to migrate to using rules_python and not rely directly on bundled Python rules APIs. Note that currently migration is automated with buildifier except for adding the entry to the WORKSPACE file.
Soo we are at Bazel 3.0 by now. Any update on when this could happen?
@lberki The Python runfiles libraries are in a weird state: Their usage instructions recommend to load them from @rules_python
, but that repo isn't defined in a default WORKSPACE. If the current issue isn't expected to be resolved soon, https://github.com/bazelbuild/bazel/commit/e4ccba45376f74d24ce3506fb4057e1268f01a59 should probably be reverted.
The actual rules_python
repo has its own version of the runfiles libraries forked at a time where it still referred to @bazel_tools
: https://github.com/bazelbuild/rules_python/blob/a2b7f4288fc7ad4ed387aa20cb2d09bf497a1b10/python/runfiles/runfiles.py. We should clarify what the source of truth is.
Similar to #8741 and #7643, force users to load bazelbuild/rules_python in order to access the built-in Python rules. This allows us to migrate these rules from native to Starlark without necessarily forcing users to migrate every step of the way. The incompatible change flag will be
--incompatible_load_python_rules_from_bzl
.Checklist:
@rules_python
@rules_python
instead of@bazel_tools