Open rickeylev opened 4 months ago
Wanted to create a separate issue for this but realized that this is already there. We could just create a python.override
tag class for the majority of the things listed above, but for starters we could start with customising the URLs for the python toolchain override.
Currently the TOOL_VERSIONS
used by the extension cannot be overridden via MODULE.bazel
. The only way users have right now is to use the bazel_downloader config, but that may give hard to debug errors and still does not allow users to add Python builds for extra platforms that are not present on the indygreg website.
Initial solution could be a python.override
tag class that can override the URLs/structs for python toolchains that are used. The design of the API should allow for future extension for different overrides:
We've had several requests where users want to modify something about the toolchain definitions that are generated for the hermetic runtimes. Typically these are small tweaks. Allowing other modules to tweak toolchains is a no-go, but allowing the root module to change things is reasonable.
The "simple" option for customizing toolchains is to add args to
python_register_toolchains
andpython.toolchain
.The two main issues I see with adding args is:
--bootstrap_impl=script
.Adding args to
python.toolchain
is, I think, a bad idea. Having something else, e.g.python.root_config
might make a bit more sense. That said, args onpython.toolchain()
make it easy to associate something to a particular toolchain, whilepython.root_config
would need some arg to specify which toolchain it wanted to restrict the setting to.This issue is to collect the use cases and try and figure out some options.
Things people want to change:
[ ] Overriding bootstrap template
python_register_toolchains()
.[ ] Customizing stub_shebang: https://bazelbuild.slack.com/archives/CA306CEV6/p1721464127008299
-S PYTHONNOUSERSITE=1
for all their Python invocationsinterpreter_args
and makeenv
populate values into the bootstrap.[ ] The register_coverage_tool arg
[ ] Control whether local or hermetic runtimes are used
local=True|False
arg when defining a toolchain. It decides whether the hermetic runtime repo rule or local runtime repo rule is used under the hood.[ ] Control whether runtimes are in-build or platform runtimes
inbuild=True|False
arg when defining a toolchain. It controls whether the underlyingpy_runtime()
targets generated useinterpreter=
orinterpreter_path=
[ ] Control constraints of toolchains
[x] Control what toolchain versions are available