//python:py_exec_tools_toolchain.bzl

Toolchain for build-time tools.

rulepy_exec_tools_toolchain(name,exec_interpreter='@rules_python//python/private:current_interpreter_executable',precompiler=None)

Provides a toolchain for build time tools.

This providesToolchainInfo with the following attributes:

  • exec_tools:PyExecToolsInfo

  • toolchain_label:Labelonly present when--visibile_for_testing=Truefor internal testing. The rule’s label; this allows identifying what toolchainimplmentation was selected for testing purposes.

Attributes:
  • name(Name)

    A unique name for this target.

    mandatory

  • exec_interpreter(label)(default“@rules_python//python/private:current_interpreter_executable”)

    An interpreter that is directly usable in the exec configuration

    If not specified, the interpreter from//python:toolchain_type willbe used.

    To disable, specify the special target//python:none; the raw valueNonewill use the default.

    Note

    This is only useful forctx.actions.run calls thatdirectly invoke theinterpreter, which is fairly uncommon and low level. It is better to use acfg="exec" attribute that points to apy_binary rule instead, which willhandle all the necessary transitions and runtime setup to invoke a program.

    SeePyExecToolsInfo.exec_interpreter for further docs.

    Changed in version 1.4.0:From now on the provided target also needs to provideplatform_common.ToolchainInfoso that the toolchainpy_runtime field can be correctly forwarded.

    optional

    Required providers:[DefaultInfo,ToolchainInfo]

  • precompiler(label)(defaultNone)

    SeePyExecToolsInfo.precompiler

    optional