Skip to content

Reimplement rules in Starlark in rules_python #1069

@rickeylev

Description

@rickeylev

This is the general tracking issue for re-implementing the Bazel-bundled Python rules in Starlark in the rules_python repo.

The Bazel-side issue is bazelbuild/bazel#15897

As of now (Feb 2023), the Bazel bundled rules (not providers or flags, though) have all been re-implemented in Starlark. They will used in Bazel 7. Hooks for low-level Bazel behaviors the Python rules need are exposed to the rules_python repo. So now this is mostly a matter of copying that code over here, cleaning it up, and flushing out any missing hooks.

TODO

  • Copy Bazel code over to rules_python
  • Re-implement Bazel tests in rules_python
  • Re-implement flags in Starlark
  • Setup a CI config that uses e.g. bazel=rolling to get access to pre-release bazel versions
  • Enable pystar by default

That's the high level gist, some lower level TODOs are:

  • Implement compatibility shim so rules_python and Bazel rules can interoperate to some degree
  • Deprecate and remove Bazel-bundled flags
  • Deprecate and remove Python-related parts in @bazel_tools

An optional bonus thing is to backport the low-level hooks to 5.x and/or 6.x. This makes them available sooner, so that we don't have to wait for Bazel 7. There isn't a ton to backport (I intentionally made them to be amenable to this idea), but there's several small pieces. The two general pieces are exposing the flags as fragments and the py_internal object:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions