跳到主要內容

設定 conda-forge.yml

您可以透過 feedstock 根目錄中存在的 conda-forge.yml 檔案,設定 conda-forge 的設定方式和建置方式。

修改此檔案後,通常需要重新渲染 feedstock,而且始終是個好主意(請參閱重新渲染 feedstocks)。

下一節詳細描述 conda-forge.yml 中的頂層欄位。

conda-forge.yml 結構描述

資訊
此文件是從自動生成的 conda-smithy 的 JSON 結構描述.

此模型詳細描述了 conda-forge.yml 中的頂層欄位。一般設定選項在下方的 Fields 規格中描述。其他範例作為物件描述的一部分提供。值和選項可能會變更,並會在適當時標記為已棄用。

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 自動勾選機器人的行為,該機器人會針對 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 solver 的頻道優先順序層級。如需更多資訊,請參閱 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 clone 的深度。

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 solver 外掛程式。

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-forge-pinning 的獨佔 conda-build 設定檔。僅適用於進階使用。

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 的檢查方式。此類設定的範例是

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 進行檢查。此選項可用於啟用 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 等工具可能會根據需要修改此設定。