feat: add static plugin#72
Merged
Merged
Conversation
Adds `dynamic_metadata.plugins.static`, which returns its settings verbatim as a `[project]` fragment — an alternative to writing fields in `[project]`. Its main use is feeding a transform pipeline: it gives a later entry such as `substitute` a *dynamic* value to modify, which a `[project]` value cannot be (a scalar may not be both static and dynamic per PEP 808). It can also keep metadata out of `[project]`, hiding it from tools that read `[project]`. The plugin is a thin passthrough; the loader already validates field names and that each is listed in `project.dynamic`. Assisted-by: ClaudeCode:claude-opus-4.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Adds a
staticplugin: an alternative to writing fields in[project].What it does
dynamic_metadata.plugins.staticreturns its settings verbatim as a[project]fragment. It's a thin passthrough — the loader already validates field names againstALL_FIELDSand enforces that each is listed inproject.dynamic.Two intended uses:
substitutea dynamic value to modify, which a[project]value can't be (a scalar field may not be both static and dynamic per PEP 808).[project]directly.Design note
staticis a pure passthrough rather than shape-validating values. This keeps it faithful to "an alternative to[project]" — e.g. it allows a stringreadme(a path), which[project]permits. No schema change needed;toml_schema.jsonalready allows arbitrary per-entry properties.Changes
src/dynamic_metadata/plugins/static.py— new plugindocs/plugins.md— newstaticsection (four → five plugins)README.md— addedstaticto the bundled-plugins listtests/test_package.py— 4 new tests (multi-field set, static→substitute pipeline, unknown-field rejection, must-be-dynamic check)All 59 tests pass;
prek -a(ruff, mypy, check-sdist, …) is clean.