Skip to content

Python bindings#

These are the API docs for the rattler_build Python bindings.

build_recipes #

build_recipes(
    recipes,
    up_to=None,
    build_platform=None,
    target_platform=None,
    host_platform=None,
    channel=None,
    variant_config=None,
    ignore_recipe_variants=False,
    render_only=False,
    with_solve=False,
    keep_build=False,
    no_build_id=False,
    package_format=None,
    compression_threads=None,
    no_include_recipe=False,
    test=None,
    output_dir=None,
    auth_file=None,
    channel_priority=None,
    skip_existing=None,
    noarch_build_platform=None,
)

Build packages from a list of recipes.

Parameters:

Name Type Description Default
recipes List[Union[str, Path]]

The recipe files or directories containing recipe.yaml.

required
up_to Union[str, None]

Build recipes up to the specified package.

None
build_platform Union[str, None]

The build platform to use for the build (e.g. for building with emulation, or rendering).

None
target_platform Union[str, None]

The target platform for the build.

None
host_platform Union[str, None]

The host platform for the build. If set, it will be used to determine also the target_platform (as long as it is not noarch).

None
channel Union[List[str], None]

Add a channel to search for dependencies in.

None
variant_config Union[List[str], None]

Variant configuration files for the build.

None
ignore_recipe_variants bool

Do not read the variants.yaml file next to a recipe.

False
render_only bool

Render the recipe files without executing the build.

False
with_solve bool

Render the recipe files with solving dependencies.

False
keep_build bool

Keep intermediate build artifacts after the build.

False
no_build_id bool

Don't use build id(timestamp) when creating build directory name.

False
package_format Union[str, None]

The package format to use for the build. Can be one of tar-bz2 or conda. You can also add a compression level to the package format, e.g. tar-bz2:<number> (from 1 to 9) or conda:<number> (from -7 to 22).

None
compression_threads Union[int, None]

The number of threads to use for compression (only relevant when also using --package-format conda).

None
no_include_recipe bool

Don't store the recipe in the final package.

False
test Union[str, None]

The strategy to use for running tests.

None
output_dir Union[str, Path, None]

The directory to store the output.

None
auth_file Union[str, Path, None]

The authentication file.

None
channel_priority Union[str, None]

The channel priority.

None
skip_existing Union[str, None]

Whether to skip packages that already exist in any channel. If set to none, do not skip any packages, default when not specified. If set to local, only skip packages that already exist locally, default when using --skip-existing. If set to all, skip packages that already exist in any channel.

None
noarch_build_platform Union[str, None]

Define a "noarch platform" for which the noarch packages will be built for. The noarch builds will be skipped on the other platforms.

None

Returns:

Type Description
None

None

test_package #

test_package(
    package_file,
    channel=None,
    compression_threads=None,
    auth_file=None,
    channel_priority=None,
)

Run a test for a single package.

Parameters:

Name Type Description Default
package_file Union[str, Path]

The package file to test.

required
channel Union[List[str], None]

Channels to use when testing.

None
compression_threads Union[int, None]

The number of threads to use for compression.

None
auth_file Union[str, Path, None]

The authentication file.

None
channel_priority Union[str, None]

The channel priority.

None

Returns:

Type Description
None

None

upload_package_to_quetz #

upload_package_to_quetz(
    package_files,
    url,
    channels,
    api_key=None,
    auth_file=None,
)

Upload to a Quetz server. Authentication is used from the keychain / auth-file.

Parameters:

Name Type Description Default
package_files List[str]

The package files to upload.

required
url str

The URL of the Quetz server.

required
channels str

The channels to upload the package to.

required
api_key Union[str, None]

The API key for authentication.

None
auth_file Union[str, Path, None]

The authentication file.

None

Returns:

Type Description
None

None

upload_package_to_artifactory #

upload_package_to_artifactory(
    package_files, url, channels, token=None, auth_file=None
)

Upload to an Artifactory channel. Authentication is used from the keychain / auth-file.

Parameters:

Name Type Description Default
package_files List[str]

The package files to upload.

required
url str

The URL to your Artifactory server.

required
channels str

The URL to your channel.

required
token Union[str, None]

Your Artifactory token.

None
auth_file Union[str, Path, None]

The authentication file.

None

Returns:

Type Description
None

None

upload_package_to_prefix #

upload_package_to_prefix(
    package_files,
    url,
    channels,
    api_key=None,
    auth_file=None,
)

Upload to a prefix.dev server. Authentication is used from the keychain / auth-file.

Parameters:

Name Type Description Default
package_files List[str]

The package files to upload.

required
url str

The URL to the prefix.dev server (only necessary for self-hosted instances).

required
channels str

The channel to upload the package to.

required
api_key Union[str, None]

The prefix.dev API key, if none is provided, the token is read from the keychain / auth-file.

None
auth_file Union[str, Path, None]

The authentication file.

None

Returns:

Type Description
None

None

upload_package_to_anaconda #

upload_package_to_anaconda(
    package_files,
    owner,
    channel=None,
    api_key=None,
    url=None,
    force=False,
    auth_file=None,
)

Upload to an Anaconda.org server.

Parameters:

Name Type Description Default
package_files List[str]

The package files to upload.

required
owner str

The owner of the Anaconda.org account.

required
channel Union[List[str], None]

The channels to upload the package to.

None
api_key Union[str, None]

The Anaconda.org API key.

None
url Union[str, None]

The URL to the Anaconda.org server.

None
force bool

Whether to force the upload.

False
auth_file Union[str, Path, None]

The authentication file.

None

Returns:

Type Description
None

None

upload_packages_to_conda_forge #

upload_packages_to_conda_forge(
    package_files,
    staging_token,
    feedstock,
    feedstock_token,
    staging_channel=None,
    anaconda_url=None,
    validation_endpoint=None,
    provider=None,
    dry_run=False,
)

Upload to conda forge.

Parameters:

Name Type Description Default
package_files List[Union[str, Path]]

The package files to upload.

required
staging_token str

The staging token for conda forge.

required
feedstock str

The feedstock repository.

required
feedstock_token str

The feedstock token.

required
staging_channel Union[str, None]

The staging channel for the upload.

None
anaconda_url Union[str, None]

The URL to the Anaconda.org server.

None
validation_endpoint Union[str, None]

The validation endpoint.

None
provider Union[str, None]

The provider for the upload.

None
dry_run bool

Whether to perform a dry run.

False

Returns:

Type Description
None

None