rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Add proof-of-concept for a Starlark-based Python version transition

Open brandjon opened this issue 4 years ago • 4 comments

This is a demo, not production ready.

Notes for #241.

brandjon avatar May 12 '20 20:05 brandjon

This is pretty neat. Do you have any sense for when the upstream functionality in Bazel will be production ready?

andyscott avatar May 23 '20 15:05 andyscott

Do you mean Starlark-Based Configuration transitions? +@juliexxia for that.

There actually exists a native Python version transition but it's experimental (intended for Google's own Python 2-to-3 transition) and can be removed at any time. Ideally we don't want to add more expressiveness to the native rules when a Starlark-based solution exists. As far as I'm aware you could use this Starlark proof of concept today if you don't mind the whitelist verbiage / experimentality of Starlark transitions and the output directory name mangling.

In the long term, it's possible the path to output files may become based on their inputs rather than a hash of the config, at which point the name mangling won't matter. But that's outside my wheelhouse.

brandjon avatar May 23 '20 20:05 brandjon

Everything SBC-related in this PR is fully functional and ready to use. I'm actually in the process of removing all the experimental flags right now thought the APIs have been stable for a while.

As far as I'm aware you could use this Starlark proof of concept today if you don't mind the whitelist verbiage / experimentality of Starlark transitions and the output directory name mangling. Yep!

In the long term, it's possible the path to output files may become based on their inputs rather than a hash of the config, at which point the name mangling won't matter. But that's outside my wheelhouse I believe bazel has purposefully never made promises about the structure of the output path and so I wouldn't depend on this changing anytime soon (and even if it does, i wouldn't depend on it staying any kind of way (: ). the output directory is changed to ensure that artifacts from transitioned targets don't class with artifacts from non-transitioned.

juliexxia avatar May 26 '20 19:05 juliexxia

@juliexxia has the been any movement internally at Google on a transition to Starlark-based rules? This is an important change that can't really happen without a lot of coordination between Google and community maintainers 🙂.

thundergolfer avatar Mar 31 '21 02:03 thundergolfer