Skip to content

feat: map config-settings to dynamic-metadata plugin settings - #1632

Merged
henryiii merged 6 commits into
mainfrom
feat/metadata-config-setting
Nov 24, 2026
Merged

henryiii merged 6 commits into
mainfrom
feat/metadata-config-setting

Conversation

@henryiii

@henryiii henryiii commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 AI text below 🤖

Alternative to #1631 for #1608.

A [[tool.dynamic-metadata]] entry can map plugin settings to package-declared config-settings with a tool.scikit-build.config-settings table in the entry:

[tool.scikit-build.config-setting."torch.variant"]
env = "PYTORCH_VARIANT"

[[tool.dynamic-metadata]]
provider = "torch-deps"
variant = "cpu"
tool.scikit-build.config-settings.variant = "torch.variant"

The plugin receives variant = "cu130" as if it was written in the entry. The provider protocol does not change, so plugins stay backend-agnostic.

  • The value is the resolved one (env binding > -C > declaration default).
  • The static value in the entry is used when the setting resolves to no value.
  • All hooks that take settings receive it: dynamic_metadata, get_requires_for_dynamic_metadata, and dynamic_wheel.
  • The entry's tool key is never passed to a plugin. Tables of other backends in it are ignored.
  • The mapping cannot set provider or tool. An undeclared setting, a value that is not a string, and an unknown key in tool.scikit-build are errors.
  • scikit-build build project-table applies the mapping and has a new -C option.

Known limits:

  • The dynamic-metadata spec reserves the entry tool key for backends in feat: reserve tool entry key for build backends dynamic-metadata#121. The spec does not check its contents, so all validation is here. A backend on the earlier spec passes tool to the plugin.
  • The deprecated tool.scikit-build.metadata table does not support the mapping.
  • A field that depends on a setting can differ between the SDist and the wheel. The plugin must still report it with dynamic_wheel.

A plugin setting can be `{config-setting = "name"}`, the same form as
`cmake.define`. The resolved value replaces the reference before any
provider hook is called, so the provider protocol does not change.

Assisted-by: ClaudeCode:claude-fable-5-2
Replace the inline `{config-setting = "name"}` value with a
`config-settings` table in each `[[tool.dynamic-metadata]]` entry. The
static value stays as the fallback, and the key is never passed to a
plugin. The legacy `tool.scikit-build.metadata` table is not supported.

Assisted-by: ClaudeCode:claude-fable-5-2
@henryiii henryiii changed the title feat: config-setting references in dynamic-metadata plugin settings feat: map config-settings to dynamic-metadata plugin settings Nov 18, 2026
The dynamic-metadata spec reserves `tool` in each entry, with one table
per backend. Read the mapping from `tool.scikit-build.config-settings`,
ignore the tables of other backends, and never pass `tool` to a plugin.

Assisted-by: ClaudeCode:claude-fable-5-2
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
GetRequires() now reads the resolved dynamic-metadata entries, so it
agrees with GetRequires.from_config_settings(). A mapping needs
minimum-version 1.2 or later when a minimum is set. The project-table
command uses SettingsReader, so it rejects unknown config-setting names
as a build does.

Assisted-by: ClaudeCode:claude-fable-5-2
@henryiii
henryiii marked this pull request as ready for review November 23, 2026 22:15
Match the singular spelling used by the declaration table, defines,
overrides, and format keys.

Assisted-by: ClaudeCode:claude-opus-5-5
@henryiii
henryiii merged commit c0b2ce2 into main Nov 24, 2026
110 of 112 checks passed
@henryiii
henryiii deleted the feat/metadata-config-setting branch November 24, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant