Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 2.22 KB

pex.md

File metadata and controls

44 lines (28 loc) · 2.22 KB

Create a zip file containing a full Python application.

Follows PEP-441 (PEX)

Ensuring a compatible interpreter is used

The resulting zip file does not contain a Python interpreter. Users are expected to execute the PEX with a compatible interpreter on the runtime system.

Use the python_interpreter_constraints to provide an error if a wrong interpreter tries to execute the PEX, for example:

py_pex_binary(
    python_interpreter_constraints = [
        "CPython=={major}.{minor}.{patch}",
    ]
)

py_pex_binary

py_pex_binary(name, binary, inject_env, python_interpreter_constraints, python_shebang)

Build a pex executable from a py_binary

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
binary A py_binary target Label required
inject_env Environment variables to set when running the pex binary. Dictionary: String -> String optional {}
python_interpreter_constraints Python interpreter versions this PEX binary is compatible with. A list of semver strings. The placeholder strings {major}, {minor}, {patch} can be used for gathering version information from the hermetic python toolchain. List of strings optional ["CPython=={major}.{minor}.*"]
python_shebang - String optional "#!/usr/bin/env python3"