Greetings Pythoneering Bazelers,
We’ve had a little time for the dust to settle from BazelCon 2018, and I wanted to recap our plans for better Python support in the short and long term. I’ll talk first about community and then about some of the upcoming technical work. (For those who weren’t able to attend the Python SIG, slides are here.)
My main takeaway from the conference was that there is a lot of potential bandwidth in the community for contributing Starlark rules and bugfixes. It seems there are two main blockers on the Bazel side. First, we have not provided the community with a centralized place to merge these contributions. Second, it is difficult to write Starlark rules that build on existing Python support. Both of these factors lead to forked rulesets and redundant efforts.
To the first point, we want to make bazelbuild/rules_python the canonical repository for Python rules and designs. This has always been the plan unofficially, but it’s important to say so explicitly. From an end-user perspective, people should be able to trust that this repo supports their core use cases, is well-maintained, and is of production quality. From an ecosystem perspective, new experimental rules should aim to be compatible with this repo.
The choice to make rules_python the focal point, as opposed to rules_pyz or another repo, is just a matter of namespacing and not an endorsement of this ruleset’s particular existing design. We’ll deprecate, modify, and merge features as needed to reach an end-state that makes sense.
As a small step in this direction, going forward, all design proposals that affect Python support will be indexed there. In particular, proposals that affect the native Python rules will be indexed both in bazelbuild/rules_python and in bazelbuild/proposals, and will be subject to the Bazel design process.
The second point, that it is difficult to write rules that interoperate with native Python rules, can be addressed by adding a well-defined “sandwich” API to the native Python rules, like we are doing for other native rulesets. Eventually the native rules will simply be migrated to Starlark and live in rules_python, though we don’t anticipate that happening in the immediate future.
The core technical improvements that we plan to make in the native rules over the next few quarters include the following (think of this as an abridged roadmap):
Revamp the model for supporting Python 2 and 3 in the same build (Q4; see tracking bug and a design proposal I’ll link in a separate email)
Support multiple Python interpreters in the same build, with per-target and toolchain-based interpreter selection (Q4-Q1)
Improve/redesign pip integration, so that there’s an officially blessed ruleset that allows for multiplatform builds of projects having PyPI dependencies (Q4-Q1..?)
Sandwich API (native rules can depend on Starlark-written ones and vice versa) (Q1-Q2)
Redesign/document runfiles layout (Q1-Q2)
These are rough estimates, of course. Importantly, the following items have *lower* priority than the above goals:
Building CPython extensions within Bazel (as opposed to depending on them via pre-built wheels)
Rules for building or deploying PyPI packages
Migrating all native rules to Starlark (in rules_python)
Vendoring CPython itself into the build (but note that toolchain rules will make it easier to depend on the system interpreter across multiplatform builds)
Various tooling integrations (linting, typing, etc.)
Once again, thanks for all the great input at the conference, and your continued involvement with Bazel and Python.
--
You received this message because you are subscribed to the Google Groups "Bazel/Python Special Interest Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-sig-pyth...@googlegroups.com.
To post to this group, send email to bazel-si...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-sig-python/3b794d90-134a-49a1-a2b8-65c52b35f3f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-sig-python/CAEoyrevCGMw2tMzGtO7FxWQU4oyQ_MCcDNdafvJigvj3i61y_g%40mail.gmail.com.