Global Symbols

This document lists every single global type, variable, and function available in PyOxidizer’s Starlark execution environment.

In addition to the symbols provided by PyOxidizer’s Starlark dialect, there are also the Starlark built-ins.

Global Types

PyOxidizer’s Starlark dialect defines the following custom types:

File
Represents a filesystem path and content.
FileContent

Represents the content of a file on the filesystem.

(Unlike File, this does not track the filename internally.)

FileManifest
Represents a mapping of filenames to file content.
PythonDistribution

Represents an implementation of Python.

Used for embedding into binaries and running Python code.

PythonEmbeddedResources
Represents resources made available to a Python interpreter.
PythonExecutable
Represents an executable file containing a Python interpreter.
PythonExtensionModule
Represents a compiled Python extension module.
PythonInterpreterConfig
Represents the configuration of a Python interpreter.
PythonPackageDistributionResource
Represents a file containing Python package distribution metadata.
PythonPackageResource
Represents a non-module resource data file.
PythonPackagingPolicy
Represents a policy controlling how Python resources are added to a binary.
PythonModuleSource
Represents a .py file containing Python source code.

Global Constants

The Starlark execution environment defines various variables in the global scope which are intended to be used as read-only constants. The following sections describe these variables.

BUILD_TARGET_TRIPLE

The string Rust target triple that we’re currently building for. Will be a value like x86_64-unknown-linux-gnu or x86_64-pc-windows-msvc. Run rustup target list to see a list of targets.

CONFIG_PATH

The string path to the configuration file currently being evaluated.

CONTEXT

Holds build context. This is an internal variable and accessing it will not provide any value.

CWD

The current working directory. Also the directory containing the active configuration file.

Global Functions

PyOxidizer’s Starlark dialect defines the following global functions:

default_python_distribution()
Obtain the default PythonDistribution for the active build configuration.
glob()
Collect files from the filesystem.
register_target()
Register a named target that can be built.
resolve_target()
Build/resolve a specific named target.
resolve_targets()
Triggers resolution of requested build targets.
set_build_path()
Set the filesystem path to use for writing files during evaluation.

Types with Target Behavior

As described in Targets, a function registered as a named target can return a type that has special build or run behavior.

The following types have special behavior registered:

FileManifest

Build behavior is to materialize all files in the file manifest.

Run behavior is to run the last added PythonExecutable if available, falling back to an executable file installed by the manifest if there is exactly 1 executable file.

PythonEmbeddedResources

Build behavior is to write out files this type represents.

There is no run behavior.

PythonExecutable

Build behavior is to build the executable file.

Run behavior is to run that built executable.