跳到主要内容

配置 conda-forge.yml

您可以通过 feedstock 根目录中存在的 conda-forge.yml 文件来配置 conda-forge 的设置和构建方式。

修改此文件后,通常需要重新渲染 feedstock,而且始终是一个好主意(请参阅重新渲染 feedstocks)。

下一节详细描述了 conda-forge.yml 中的顶层字段。

conda-forge.yml 模式

信息
本文档是自动生成的,来自 conda-smithy 的 JSON 模式.

此模型详细描述了 conda-forge.yml 中的顶层字段。 常规配置选项在下面的 字段 规范中描述。 其他示例作为对象描述的一部分提供。 值和选项可能会发生变化,并将酌情标记为已弃用。

appveyor

AppVeyor CI 设置。 这通常是只读的,通常不应手动修改。 诸如 conda-smithy 之类的工具可以根据需要修改此项。

azure

Azure Pipelines CI 设置。 这通常是只读的,通常不应手动修改。 诸如 conda-smithy 之类的工具可以根据需要修改此项。 例如

azure:
# flag for forcing the building all supported providers
force: False
# toggle for storing the conda build_artifacts directory (including the
# built packages) as an Azure pipeline artifact that can be downloaded
store_build_artifacts: False
# toggle for freeing up some extra space on the default Azure Pipelines
# linux image before running the Docker container for building
free_disk_space: False
# limit the amount of CI jobs running concurrently at a given time
# each OS will get its proportional share of the configured value
max_parallel: 25

以下是为 Linux 设置自托管 Azure 代理的配置示例

azure:
settings_linux:
pool:
name: your_local_pool_name
demands:
- some_key -equals some_value
workspace:
clean: all
strategy:
maxParallel: 1

以下是在 Linux 的 Azure 代理上添加交换文件的配置示例

azure:
settings_linux:
swapfile_size: 10GiB

如果 Windows 上需要更多空间,您可以使用 C:,但会牺牲 IO 性能

azure:
settings_win:
variables:
CONDA_BLD_PATH: "C:\bld"
MINIFORGE_HOME: "C:\Miniforge"

bot

这决定了 conda-forge auto-tick 机器人 的行为,该机器人为 feedstocks 发布自动版本更新/迁移。 有效的示例是

bot:
# can the bot automerge PRs it makes on this feedstock
automerge: true
# only automerge on successful version PRs, migrations are not automerged
automerge: 'version'
# only automerge on successful migration PRs, versions are not automerged
automerge: 'migration'

# only open PRs if resulting environment is solvable, useful for tightly coupled packages
check_solvable: true

# The bot.inspection key in the conda-forge.yml can have one of seven possible values and controls
# the bots behaviour for automatic dependency updates:
inspection: hint # generate hints using source code (backwards compatible)
inspection: hint-all # generate hints using all methods
inspection: hint-source # generate hints using only source code
inspection: hint-grayskull # generate hints using only grayskull
inspection: update-all # update recipe using all methods
inspection: update-source # update recipe using only source code
inspection: update-grayskull # update recipe using only grayskull
inspection: disabled # don't update recipe, don't generate hints

# any branches listed in this section will get bot migration PRs in addition
# to the default branch
abi_migration_branches:
- 'v1.10.x'

version_updates:
# use this for packages that are updated too frequently
random_fraction_to_keep: 0.1 # keeps 10% of versions at random
exclude:
- '08.14'

abi_migration_branches 功能对于例如为软件包添加长期支持 (LTS) 分支非常有用。

build_platform

这是从目标平台到要构建的软件包的构建平台的映射。 例如,以下示例在 linux-64 构建平台上使用交叉编译构建 osx-64 软件包。

build_platform:
osx_64: linux_64

将此字段留空会隐式请求本地构建软件包。 即

build_platform:
linux_64: linux_64
linux_ppc64le: linux_ppc64le
linux_aarch64: linux_aarch64
osx_64: osx_64
osx_arm64: osx_arm64
win_64: win_64

build_with_mambabuild

已弃用

build_with_mambabuild 已弃用,请改用 conda_build_tool

channel_priority

feedstock 构建期间 conda 求解器的通道优先级级别。 有关更多信息,请参阅 conda 文档中的 严格通道优先级 部分。

choco

此参数允许 conda-smithy 在 Windows 上运行 chocoloatey 安装,当需要额外的系统软件包时。 这是一个字符串列表,表示软件包名称和任何附加参数。 例如,

choco:
# install a package
- nvidia-display-driver

# install a package with a specific version
- cuda --version=11.0.3

目前仅为 Azure Pipelines 实现了此功能。 运行的命令是 choco install {entry} -fdv -y --debug。 也就是说,choco install 使用一组标准的附加标志执行,这些标志在 CI 上很有用。

circle

Circle CI 设置。 这通常是只读的,通常不应手动修改。 诸如 conda-smithy 之类的工具可以根据需要修改此项。

clone_depth

git 克隆的深度。

compiler_stack

已弃用

编译器堆栈环境变量。 这用于指定用于构建的编译器堆栈。 已弃用。

compiler_stack: comp7

conda_build

此块中的设置用于控制 conda build 的运行方式和生成工件的方式。 此类配置的一个示例是

conda_build:
pkg_format: 2
zstd_compression_level: 16
error_overlinking: False

conda_build_tool

使用此选项选择用于构建配方的工具。

conda_forge_output_validation

对于 conda-forge GitHub 组织中的 feedstocks,此字段必须设置为 True。 它启用所需 feedstock 工件验证,如输出验证和 Feedstock 令牌中所述。

conda_install_tool

使用此选项选择用于在您的 feedstock 中配置工具的工具。 默认为 micromamba。

如果选择 conda 或 mamba,则将使用最新的 Miniforge 来配置基本环境。 如果选择 micromamba 或 pixi,则不涉及 Miniforge;环境由 micromamba 或 pixi 直接创建。

conda_solver

选择要用于 feedstock 构建的 conda 求解器插件。

config_version

用于配方和 conda-forge-pinning 中 conda_build_config.yaml 文件的 conda-smithy 配置版本。 不应手动修改此项。

docker

这是 Docker 特定配置选项的映射。 一些选项是

docker:
executable: docker
command: "bash"

drone

Drone CI 设置。 这通常是只读的,通常不应手动修改。 诸如 conda-smithy 之类的工具可以根据需要修改此项。

exclusive_config_file

独占 conda-build 配置文件,用于替换 conda-forge-pinning。 仅供高级用法。

github

GitHub 特定配置选项的映射。 默认值如下

github:
user_or_org: conda-forge
repo_name: "my_repo"
branch_name: main
tooling_branch_name: main

github_actions

GitHub Actions CI 设置。 这通常是只读的,通常不应手动修改。 诸如 conda-smithy 之类的工具可以根据需要修改此项。

idle_timeout_minutes

可配置的空闲超时。 用于构建不够频繁的软件包。 仅适用于 circleci 和 travis。

idle_timeout_minutes: 60

linter

此块中的设置用于控制 conda smithy lints。 此类配置的一个示例是

linter:
skip:
- lint_noarch_selectors

matrix

已弃用

构建矩阵用于指定一组构建配置,以便为每个软件包固定的依赖项运行。 这已弃用,转而使用 provider 字段。 更多信息可以在 conda-forge 文档的 构建矩阵 部分找到。

max_py_ver

已弃用

最大 Python 版本。 这用于指定用于构建的最大 Python 版本。 已弃用。

max_py_ver: 37

max_r_ver

已弃用

最大 R 版本。 这用于指定用于构建的最大 R 版本。 已弃用。

max_r_ver: 34

min_py_ver

已弃用

最小 Python 版本。 这用于指定用于构建的最小 Python 版本。 已弃用。

min_py_ver: 27

min_r_ver

已弃用

最小 R 版本。 这用于指定用于构建的最小 R 版本。 已弃用。

min_r_ver: 34

noarch_platforms

在其上构建 noarch 包的平台。 首选默认是在 linux_64 上进行单次构建。

noarch_platforms: linux_64

要在多个平台上构建,例如对于具有平台特定依赖项的简单软件包,请提供列表。

noarch_platforms:
- linux_64
- win_64

os_version

此键用于为 linux_* 平台设置 OS 版本。 有效条目将 linux 平台和架构映射到 cos7alma8alma9ubi8

目前,alma9 是默认值,它应该适用于绝大多数用途。

请注意,镜像版本并不意味着匹配的 glibc 要求(可以使用 recipe/conda_build_config.yaml 中的 c_stdlib_version 设置)。

如果您需要选择旧版本的镜像,以下是如何操作的示例

os_version:
linux_64: cos7
linux_aarch64: cos7
linux_ppc64le: cos7

package

软件包 feedstock 目录基本名称的默认位置。

private_upload

是否上传到私有通道。

private_upload: False

provider

provider 字段是从构建平台(不是目标平台)到 CI 服务的映射。 它确定哪个服务处理每个构建平台。 如果所选提供商无法提供所需的构建平台(无论是本地还是通过模拟),则将禁用构建。 当没有提供商提供所需的构建平台时,请使用 build_platform 字段手动指定交叉编译。

以下是可用的受支持构建平台

  • linux_64
  • osx_64
  • win_64
  • linux_aarch64
  • linux_ppc64le
  • linux_s390x
  • linux_armv7l

以下 CI 服务可用

  • azure
  • circle
  • travis
  • appveyor
  • NoneFalse 以禁用构建平台。
  • default 选择合适的 CI(仅在可用时)
  • native 选择适合本地编译的 CI(仅在可用时)
  • emulated 选择适合在目标平台的模拟中编译的 CI(仅在可用时)

例如,将 linux_64 和 osx_64 切换到在 Travis CI 上构建,win_64 在 Appveyor 上构建

provider:
linux_64: travis
osx_64: travis
win_64: appveyor

目前,x86_64 平台已启用,但默认情况下禁用其他构建平台。 即,空的提供商条目等效于以下内容

provider:
linux_64: azure
osx_64: azure
win_64: azure
linux_ppc64le: None
linux_aarch64: None

要启用 linux_ppc64lelinux_aarch64,请添加以下内容

provider:
linux_ppc64le: default
linux_aarch64: default

recipe_dir

配方目录的相对路径。 默认值为

recipe_dir: recipe

remote_ci_setup

此选项可用于覆盖默认的 conda-forge-ci-setup 软件包。 可以使用 ${url or channel_alias}::package_name 给出,如果未给出前缀,则默认为 conda-forge channel_alias。

remote_ci_setup: ["conda-forge-ci-setup=4", "conda-build>=24.1"]

secrets

要在 GitHub Actions 中使用的密钥列表。 默认值为空列表,将不会使用。

shellcheck

用于构建或激活脚本的 Shell 脚本可以使用 shellcheck 进行 linting。 此选项可用于启用 shellcheck 并配置其行为。 默认情况下未启用,但可以像这样启用

shellcheck:
enabled: True

skip_render

此选项指定 conda smithy 将跳过渲染的文件列表。 这对于不是模板但仍在配方目录中的文件很有用。 默认值是一个空列表 [],它将认为所有文件都可以渲染。 例如,如果您想跳过渲染 .gitignoreLICENSE.txt 文件,您可以添加以下内容

skip_render:
- .gitignore
- LICENSE.txt

templates

这主要是用于指定模板文件所在位置的内部字段。 您无需修改它。

test

这用于配置在哪些平台上测试配方。

test: native_and_emulated

仅当平台是本地平台或存在模拟器时才进行测试。

test: native

仅当平台是本地平台时才进行测试。

test_on_native_only

已弃用

这用于禁用交叉编译的测试。

警告
这已被弃用,转而使用顶层 `test` 字段。 现在它映射到 `test: native_and_emulated`。

travis

Travis CI 设置。 这通常是只读的,通常不应手动修改。 诸如 conda-smithy 之类的工具可以根据需要修改此项。

upload_on_branch

此参数限制从同一仓库的某些分支进行工作时的上传访问权限。 只有在 upload_on_branch 中列出的分支才会触发将软件包上传到目标通道。 如果 conda-forge.yml 中没有键 upload_on_branch,则默认跳过此检查。 要限制上传到主分支

upload_on_branch: main

woodpecker

Woodpecker CI 设置。 这通常是只读的,通常不应手动修改。 诸如 conda-smithy 之类的工具可以根据需要修改此项。