-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Summary
We are commonly/regularly using the prepare_source() hook for package plugins to make simple modifications to the pyproject.toml in cases where the dynamic field is missing from the [project] header in the toml file.
Ideally, we'd be able to do this common operation as an override setting in a yaml file, instead of needing a plugin.
def prepare_source(
ctx: context.WorkContext,
req: Requirement,
source_filename: pathlib.Path,
version: Version,
) -> tuple[pathlib.Path, bool]:
source_root_dir, is_new = sources.default_prepare_source(
ctx=ctx, req=req, source_filename=source_filename, version=version
)
if is_new:
# Fix pyproject.toml: add 'readme' to dynamic field in [project] table
# to prevent AttributeError when setuptools processes the readme metadata
pyproject = source_root_dir / "pyproject.toml"
if pyproject.exists():
logger.info(
"%s: patching pyproject.toml to add readme to dynamic fields",
req.name,
)
utils.replace_lines(
pyproject,
[
(
r"^(requires-python\s*=.*)$",
r'\1\ndynamic = ["readme"]',
),
],
)
return source_root_dir, is_newWhat needs to happen
Develop a method for an override setting to work as follows:
annotations:
aipcc.component: Development Platform
project_override:
add_dynamic_field:
- readme
- version
- license
- authors
changelog:
"0.9.1":
- "2026-02-20: initial build for pydeck"Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels