PEX runtime environment variables#

PEX_ALWAYS_CACHE#

Boolean.

    Deprecated: This env var is no longer used; all internally cached distributions in a PEX
    are always installed into the local Pex dependency cache.
PEX_COVERAGE#

Boolean.

    Enable coverage reporting for this PEX file.  This requires that the "coverage" module is
    available in the PEX environment.

    Default: false.
PEX_COVERAGE_FILENAME#

Filename.

    Write the coverage data to the specified filename.  If PEX_COVERAGE_FILENAME is not
    specified but PEX_COVERAGE is, coverage information will be printed to stdout and not saved.
PEX_DISABLE_VARIABLES#

Boolean.

    Disable reading of all PEX_* variables (except this one) from all sources. Both PEX_*
    environment variables and PEX_* variables sources from pexrc files will be ignored.

    This can be used to lock down the function of a PEX.
PEX_EMIT_WARNINGS#

Boolean.

    Emit UserWarnings to stderr. When false, warnings will only be logged at PEX_VERBOSE >= 1.
    When unset the build-time value of `--emit-warnings` will be used.

    Default: unset.
PEX_EXTRA_SYS_PATH#

String.

    A ':' or ';' separated string containing paths to add to the runtime sys.path.

    Should be used sparingly, e.g., if you know that code inside this PEX needs to
    interact with code outside it.

    For example, on a Unix system: "/path/to/lib1:/path/to/lib2"

    This is distinct from PEX_INHERIT_PATH, which controls how the interpreter's
    existing sys.path (which you may not have control over) is scrubbed.

    See also PEX_PATH for how to merge packages from other pexes into the current environment.
PEX_FORCE_LOCAL#

Boolean.

    Deprecated: This env var is no longer used since user code is now always unzipped before
    execution.
PEX_IGNORE_ERRORS#

Boolean.

    Ignore any errors resolving dependencies when invoking the PEX file. This can be useful if
    you know that a particular failing dependency is not necessary to run the application.

    Default: false.
PEX_IGNORE_RCFILES#

Boolean.

    Explicitly disable the reading/parsing of pexrc files (~/.pexrc).

    Default: false.
PEX_INHERIT_PATH#

String (false|prefer|fallback)

    Allow inheriting packages from site-packages, user site-packages and the PYTHONPATH. By
    default, PEX scrubs any non stdlib packages from sys.path prior to invoking the application.
    Using 'prefer' causes PEX to shift any non-stdlib packages before the pex environment on
    sys.path and using 'fallback' shifts them after instead.

    Using this option is generally not advised, but can help in situations when certain
    dependencies do not conform to standard packaging practices and thus cannot be bundled into
    PEX files.

    See also PEX_EXTRA_SYS_PATH for how to *add* to the sys.path.

    Default: false.
PEX_INTERPRETER#

Boolean.

    Drop into a REPL instead of invoking the predefined entry point of this PEX. This can be
    useful for inspecting the PEX environment interactively.  It can also be used to treat the PEX
    file as an interpreter in order to execute other scripts in the context of the PEX file, e.g.
    "PEX_INTERPRETER=1 ./app.pex my_script.py".  Equivalent to setting PEX_MODULE to empty.

    Default: false.
PEX_INTERPRETER_HISTORY#

Boolean.

    IF PEX_INTERPRETER is true, use a command history file for REPL user convenience.
    The location of the history file is determined by PEX_INTERPRETER_HISTORY_FILE.

    Default: false.
PEX_INTERPRETER_HISTORY_FILE#

File.

    IF PEX_INTERPRETER_HISTORY is true, use this history file.
    The default is the standard Python interpreter history location.

    Default: ~/.python_history.
PEX_MAX_INSTALL_JOBS#

Integer.

    The maximum number of parallel jobs to use when installing third party dependencies
    contained in a PEX during its first boot. Values are interpreted as follows:

    * ``>=2`` Dependencies should be installed in parallel using exactly this maximum number of
      jobs.
    * ``1`` Dependencies should be installed in serial.
    * ``0`` The maximum number of parallel jobs should be auto-selected taking the number of
      cores into account.
    * ``-1`` The maximum number of parallel jobs should be auto-selected taking both the
      characteristics of the third party dependencies contained in the PEX and the number of
      cores into account. The third party dependency heuristics are intended to yield good
      install performance, but are opaque and may change across PEX releases if better
      heuristics are discovered.
    * ``<=-2`` These are illegal values; an error is raised.

    Default: 1
PEX_MODULE#

String.

    Override the entry point into the PEX file.  Can either be a module, e.g.
    'SimpleHTTPServer', or a specific entry point in module:symbol form, e.g.  "myapp.bin:main".
PEX_PATH#

A set of one or more PEX files.

    Merge the packages from other PEX files into the current environment.  This allows you to
    do things such as create a PEX file containing the "coverage" module or create PEX files
    containing plugin entry points to be consumed by a main application.  Paths should be
    specified in the same manner as $PATH. For example, on a Unix system
    PEX_PATH=/path/to/pex1.pex:/path/to/pex2.pex and so forth.

    See also PEX_EXTRA_SYS_PATH for how to add arbitrary entries to the sys.path.
PEX_PROFILE#

Boolean.

    Enable application profiling.  If specified and PEX_PROFILE_FILENAME is not specified, PEX
    will print profiling information to stdout.
PEX_PROFILE_FILENAME#

Filename.

    Profile the application and dump a profile into the specified filename in the standard
    "profile" module format.
PEX_PROFILE_SORT#

String.

    Toggle the profile sorting algorithm used to print out profile columns.

    Default: 'cumulative'.
PEX_PYTHON#

String.

    Override the Python interpreter used to invoke this PEX.  Can be either an absolute path to
    an interpreter or a base name e.g.  "python3.3".  If a base name is provided, the $PATH will
    be searched for an appropriate match.
PEX_PYTHON_PATH#

String.

    A ':' or ';' separated string containing paths of blessed Python interpreters for
    overriding the Python interpreter used to invoke this PEX. Can be absolute paths to
    interpreters or standard $PATH style directory entries that are searched for child files
    that are python binaries.

    For example, on a Unix system: "/path/to/python27:/path/to/python36-distribution/bin"
PEX_ROOT#

Directory.

    The directory location for PEX to cache any dependencies and code.  PEX must write not-zip-
    safe eggs and all wheels to disk in order to activate them.

    Default: ~/.pex
PEX_SCRIPT#

String.

    The script name within the PEX environment to execute.  This must either be an entry point
    as defined in a distribution's console_scripts, or a script as defined in a distribution's
    scripts section.  While Python supports any script including shell scripts, PEX only
    supports invocation of Python scripts in this fashion.
PEX_TEARDOWN_VERBOSE#

Boolean.

    Enable verbosity for when the interpreter shuts down.  This is mostly only useful for
    debugging PEX itself.

    Default: false.
PEX_TOOLS#

Boolean.

    Run the PEX tools.

    Default: false.
PEX_UNZIP#

Boolean.

    Deprecated: This env var is no longer used since unzipping PEX zip files before execution
    is now the default.
PEX_VENV#

Boolean.

    Force this PEX to create a venv under $PEX_ROOT and re-execute from there.  If the pex file
    will be run multiple times under a stable $PEX_ROOT the venv creation will only be performed
    once and subsequent runs will enjoy lower startup latency.

    Default: false.
PEX_VENV_BIN_PATH#

String (false|prepend|append).

    When running in PEX_VENV mode, optionally add the scripts and console scripts of
    distributions in the PEX file to the $PATH.

    Default: false.
PEX_VERBOSE#

Integer.

    Set the verbosity level of PEX debug logging.  The higher the number, the more logging, with
    0 being disabled.  This environment variable can be extremely useful in debugging PEX
    environment issues.

    Default: 0