//python/private:py_runtime_rule.bzl — rules_python 0.0.0 documentation (original) (raw)

Implementation of py_runtime rule.

rule py_runtime(name, abi_flags='', bootstrap_template='@rules_python//python/private:bootstrap_template', coverage_tool=None, files=[], implementation_name='cpython', interpreter=None, interpreter_path='', interpreter_version_info={}, pyc_tag='', python_version='PY3', site_init_template='@rules_python//python/private:site_init_template', stage2_bootstrap_template='@rules_python//python/private:stage2_bootstrap_template', stub_shebang='#!/usr/bin/env python3', supports_build_time_venv=True, zip_main_template='@rules_python//python/private:zip_main_template')

Represents a Python runtime used to execute Python code.

A py_runtime target can represent either a platform runtime or an in-build runtime. A platform runtime accesses a system-installed interpreter at a known path, whereas an in-build runtime points to an executable target that acts as the interpreter. In both cases, an “interpreter” means any executable binary or wrapper script that is capable of running a Python script passed on the command line, following the same conventions as the standard CPython interpreter.

A platform runtime is by its nature non-hermetic. It imposes a requirement on the target platform to have an interpreter located at a specific path. An in-build runtime may or may not be hermetic, depending on whether it points to a checked-in interpreter or a wrapper script that accesses the system interpreter.

Example

load("@rules_python//python:py_runtime.bzl", "py_runtime")

py_runtime( name = "python-2.7.12", files = glob(["python-2.7.12/**"]), interpreter = "python-2.7.12/bin/python", )

py_runtime( name = "python-3.6.0", interpreter_path = "/opt/pyenv/versions/3.6.0/bin/python", )

Attributes: