//python:py_executable_info.bzl

Provider for executable-specific information.

The PyExecutableInfo provider contains information about an executable that isn’t otherwise available from its public attributes or other providers.

It exposes information primarily useful for consumers to package the executable, or derive a new executable from the base binary.

provider PyExecutableInfo

Information about an executable.

This provider is for executable-specific information (e.g. tests and binaries).

Added in version 0.36.0.

PyExecutableInfo.<init>(app_runfiles, build_data_file, interpreter_args, interpreter_path, main, runfiles_without_exe, stage2_bootstrap, venv_app_symlinks, venv_interpreter_runfiles, venv_interpreter_symlinks, venv_python_exe)
PyExecutableInfo.app_runfiles: runfiles

The runfiles for the executable’s “user” dependencies. These are things in e.g. deps (or similar), but doesn’t include “external” or “implicit” pieces, e.g. the Python runtime itself. It’s roughly akin to the files a traditional venv would have installed into it.

See also

PyRuntimeInfo for the Python runtime files. The py_binary et al rules provide it directly so that the runtime the binary original chose can be accessed.

Added in version 1.9.0.

PyExecutableInfo.build_data_file: None | File

A symlink to build_data.txt if stamping is enabled, otherwise None.

PyExecutableInfo.interpreter_args: list[str]

Args that should be passed to the interpreter before regular args (e.g. -X whatever).

Added in version 1.9.0.

PyExecutableInfo.interpreter_path: None | str

Path to the Python interpreter to use for running the executable itself (not the bootstrap script). Either an absolute path (which means it is platform-specific), or a runfiles-relative path (which means the interpreter should be within runtime_files)

PyExecutableInfo.main: File

The user-level entry point file. Usually a .py file, but may also be .pyc file if precompiling is enabled.

See also

The stage2_bootstrap attribute, which bootstraps an executable to run the user main file.

PyExecutableInfo.runfiles_without_exe: runfiles

The runfiles the program needs, but without the original executable, files only added to support the original executable, or files specific to the original program.

PyExecutableInfo.stage2_bootstrap: File | None

The Bazel-executable-level entry point to the program, which handles Bazel-specific setup before running the file in main. May be None if a two-stage bootstrap implementation isn’t being used.

Added in version 1.9.0.

Symlinks that are specific to the application within the venv (e.g. dependencies).

Only used with Windows for files that would have used declare_symlink() to create relative symlinks. These may overlap with paths in runfiles; it’s up to the consumer to determine how to handle such overlaps.

Added in version VERSION_NEXT_FEATURE.

PyExecutableInfo.venv_interpreter_runfiles: runfiles | None

Runfiles that are specific to the interpreter within the venv.

Added in version 2.0.0.

Symlinks that are specific to the interpreter within the venv.

Only used with Windows for files that would have used declare_symlink() to create relative symlinks. These may overlap with paths in runfiles; it’s up to the consumer to determine how to handle such overlaps.

Added in version 2.0.0.

PyExecutableInfo.venv_python_exe: File | None

The bin/python3 file within the venv this binary uses. May be None if venv mode is not enabled.

Added in version 1.9.0.