Skip to content

Configuration#

Configuration classes for controlling build behavior and platform settings.

You can import the configuration classes from rattler_build:

from rattler_build import ToolConfiguration, PlatformConfig, JinjaConfig, RenderConfig

ToolConfiguration#

Configuration for the rattler-build tool.

Parameters:

Name Type Description Default
keep_build bool

Whether to keep the build directory after the build is done

False
compression_threads int | None

Number of threads to use for compression (default: None - auto)

None
io_concurrency_limit int | None

Maximum number of concurrent I/O operations (default: None)

None
test_strategy Literal['skip', 'native', 'tests']

Test strategy to use ("skip", "native", or "tests") (default: "skip")

'skip'
skip_existing Literal['none', 'local', 'all']

Whether to skip packages that already exist ("none", "local", or "all") (default: "none")

'none'
continue_on_failure bool

Whether to continue building other recipes even if one fails (default: False)

False
noarch_build_platform str | None

Platform to use for noarch builds (default: None)

None
channel_priority Literal['strict', 'disabled']

Channel priority for solving ("strict" or "disabled") (default: "strict")

'strict'
allow_insecure_host list[str] | None

List of hosts for which SSL certificate verification should be skipped

None
error_prefix_in_binary bool

Whether to error if the host prefix is detected in binary files (default: False)

False
allow_symlinks_on_windows bool

Whether to allow symlinks in packages on Windows (default: False)

False
use_zstd bool

Whether to use zstd compression when downloading repodata (default: True)

True
use_bz2 bool

Whether to use bzip2 compression when downloading repodata (default: True)

True
use_sharded bool

Whether to use sharded repodata when downloading (default: True)

True
Example
config = ToolConfiguration(
    keep_build=True,
    test_strategy="native",
    compression_threads=4
)
print(config.keep_build)
# True
print(config.test_strategy)
# Native

keep_build property #

keep_build

Whether to keep the build directory after the build is done.

test_strategy property #

test_strategy

The test strategy to use.

skip_existing property #

skip_existing

Whether to skip existing packages.

continue_on_failure property #

continue_on_failure

Whether to continue building on failure.

channel_priority property #

channel_priority

The channel priority to use in solving.

use_zstd property #

use_zstd

Whether to use zstd compression.

use_bz2 property #

use_bz2

Whether to use bzip2 compression.

use_sharded property #

use_sharded

Whether to use sharded repodata.

compression_threads property #

compression_threads

Number of compression threads.

io_concurrency_limit property #

io_concurrency_limit

IO concurrency limit.

allow_insecure_host property #

allow_insecure_host

List of hosts for which SSL certificate verification should be skipped.

error_prefix_in_binary property #

error_prefix_in_binary

Whether to error if the host prefix is detected in binary files.

allow_symlinks_on_windows

Whether to allow symlinks in packages on Windows.

__init__ #

__init__(
    *,
    keep_build=False,
    compression_threads=None,
    io_concurrency_limit=None,
    test_strategy="skip",
    skip_existing="none",
    continue_on_failure=False,
    noarch_build_platform=None,
    channel_priority="strict",
    allow_insecure_host=None,
    error_prefix_in_binary=False,
    allow_symlinks_on_windows=False,
    use_zstd=True,
    use_bz2=True,
    use_sharded=True,
)

Create a new tool configuration.

PlatformConfig#

Platform configuration for building packages.

This class provides platform settings that are shared across different configuration objects (JinjaConfig, RenderConfig).

Parameters:

Name Type Description Default
target_platform str | None

Target platform (e.g., "linux-64", "osx-arm64"). If not specified, defaults to the current platform.

None
build_platform str | None

Build platform (where the build runs). If not specified, defaults to the target platform.

None
host_platform str | None

Host platform (for cross-compilation). If not specified, defaults to the target platform.

None
experimental bool

Enable experimental features

False
Example
# Create with default (current) platform
config = PlatformConfig()

# Create for a specific platform (build and host will default to target)
config = PlatformConfig(target_platform="linux-64")

# Create with different platforms for cross-compilation
config = PlatformConfig(
    target_platform="osx-arm64",
    build_platform="linux-64",
    host_platform="osx-arm64"
)

target_platform instance-attribute #

target_platform = target_platform

build_platform instance-attribute #

build_platform = (
    build_platform if build_platform is not None else None
)

host_platform instance-attribute #

host_platform = (
    host_platform if host_platform is not None else None
)

experimental instance-attribute #

experimental = experimental

__init__ #

__init__(
    *,
    target_platform=None,
    build_platform=None,
    host_platform=None,
    experimental=False,
)

Create a new platform configuration.

JinjaConfig#

Python wrapper for PyJinjaConfig to provide a cleaner interface.

Parameters:

Name Type Description Default
platform PlatformConfig | None

Platform configuration (target, build, host platforms, experimental flag)

None
allow_undefined bool | None

Whether to allow undefined variables in Jinja templates

None
variant dict[str, Any] | None

Variant configuration dictionary

None
recipe_path str | Path | None

Path to the recipe file (for relative path resolution in Jinja functions)

None
Example
from rattler_build.tool_config import PlatformConfig

platform = PlatformConfig(target_platform="linux-64")
config = JinjaConfig(platform=platform)

target_platform property #

target_platform

Get the target platform.

host_platform property #

host_platform

Get the host platform.

build_platform property #

build_platform

Get the build platform.

experimental property #

experimental

Get whether experimental features are enabled.

allow_undefined property #

allow_undefined

Get whether undefined variables are allowed.

variant property #

variant

Get the variant configuration.

recipe_path property #

recipe_path

Get the recipe path.

__init__ #

__init__(
    platform=None,
    allow_undefined=None,
    variant=None,
    recipe_path=None,
)