Skip to content

Conversation

@LecrisUT
Copy link
Collaborator

A few preparations for #999

@LecrisUT LecrisUT requested a review from henryiii April 23, 2025 13:42
@LecrisUT LecrisUT force-pushed the doc/refactor_fields branch 2 times, most recently from e2b935e to 36580fc Compare April 23, 2025 15:40
- Moved default text handling to a separate function
- Prepare to read metadata fields from dataclasses.Field.metadata
- Added a dataclass holder for the dataclass field metadata for documentation

Signed-off-by: Cristian Le <[email protected]>
@LecrisUT LecrisUT force-pushed the doc/refactor_fields branch from 36580fc to b965df7 Compare April 23, 2025 16:16
@henryiii
Copy link
Collaborator

Oh, interesting, I considered this before, but I was looking at annotations, this might be better. I'll try to review soon, working on the partially dynamic metadata PEP proposal currently.

Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
@henryiii henryiii requested a review from Copilot April 25, 2025 03:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new metadata mechanism for setting fields to support enhanced default display values and deprecation handling as part of preparations for #999. Key changes include:

  • Introducing a new TypedDict (SettingsFieldMetadata) to annotate dataclass fields.
  • Updating several settings classes (CMakeSettings, NinjaSettings, WheelSettings, InstallSettings, ScikitBuildSettings) to use dataclasses.field with metadata.
  • Modifying documentation generation in both skbuild_docs.py and documentation.py to leverage the metadata and filter out deprecated fields.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/scikit_build_core/settings/skbuild_model.py Updates to dataclass field defaults with metadata for deprecation/display.
src/scikit_build_core/settings/skbuild_docs.py Simplified docs generation by filtering out deprecated fields.
src/scikit_build_core/settings/documentation.py Enhancements to DCDoc and default sanitization to support metadata usage.
Comments suppressed due to low confidence (1)

src/scikit_build_core/settings/skbuild_docs.py:18

  • [nitpick] Verify that filtering out all deprecated items from the documentation is the intended behavior, as this change may hide fields that some consumers might still expect to see.
str(item) for item in mk_docs(ScikitBuildSettings) if not item.deprecated

@henryiii henryiii merged commit 5a8a8f4 into scikit-build:main Apr 25, 2025
63 of 64 checks passed
@LecrisUT LecrisUT deleted the doc/refactor_fields branch April 25, 2025 12:11
henryiii added a commit that referenced this pull request Apr 26, 2025
Also adding back a couple of test files that I wrote but missed adding
in previous PRs:

* #1051
* #1047

Signed-off-by: Henry Schreiner <[email protected]>
henryiii pushed a commit that referenced this pull request May 6, 2025
This would make it easier to cross-reference. I was debating going for
an auto-generated one and integrating with sphinx directly or going with
the `nox -t gen` files, and I think I prefer the latter because it makes
it more obvious to review the generated text in all the places, wdyt?

I also want to unlock usage of sphinx roles in it, but the readme
generation gets in the way. My opinion is that if we have this, we could
either move the readme part to the generated page, or truncate it to
only display the first summary sentence similar to how `click` does it.

Depends-on: #1051
Closes #999

---------

Signed-off-by: Cristian Le <[email protected]>
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.

2 participants