Standardize configclass type metadata - #6923
Conversation
Replace the legacy Pylance marker with the standard PEP 681 decorator so type checkers can preserve decorated class types and infer dataclass behavior.
Greptile SummaryThe PR replaces the legacy type-checker-specific marker with standard PEP 681 metadata while preserving the decorated class type through a generic signature.
Confidence Score: 5/5The PR appears safe to merge, with no concrete runtime, build, or current static-analysis regressions identified. The decorator continues forwarding classes and keyword arguments to the existing dataclass implementation while adding standard metadata and preserving class identity in its type signature; current call sites use no decorator options that would create a metadata mismatch. Important Files Changed
Reviews (1): Last reviewed commit: "Remove contributor list update" | Re-trigger Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
The PEP 681 migration and generic decorator signature are appropriate, but the declared transform metadata does not include the standard dataclass field specifiers used by config classes throughout the repository.
- Design and architecture: Standardizing on
typing.dataclass_transformpreserves the existing runtime decorator path while making its dataclass-like behavior portable to type checkers. The metadata should also model the supporteddataclasses.field/Fieldconstructs so static analysis matches actual configuration-class semantics. - API: The
@configclasscalling convention and decorated class identity are preserved by thetype[_T] -> type[_T]signature. However, the public typing contract currently leavesfield_specifiersempty, so options such asinit=Falseandkw_only=Trueare not represented to PEP 681 consumers. - Implementation: The runtime implementation remains unchanged, and the metadata regression test covers the default transform flags. Add
dataclasses.fieldanddataclasses.Fieldtofield_specifiersand extend the metadata test accordingly, matching the field usage already documented and supported byconfigclass.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
Carry the net change from upstream PR isaac-sim#6923 on the downstream integration branch so configclass exposes standard PEP 681 metadata.
Carry the net change from upstream PR isaac-sim#6923 on the downstream integration branch so configclass exposes standard PEP 681 metadata.
Summary
typing.dataclass_transform.configclasssignature.Motivation
The existing helper predates the standardized
typing.dataclass_transformAPI. It is a runtime no-op and does not expose PEP 681 metadata, leaving dataclass constructor and decorated-class inference dependent on legacy type-checker behavior. Isaac Lab now requires Python 3.12, soconfigclasscan use the standard decorator directly and provide portable metadata to modern type checkers.Validation
configclass.__dataclass_transform__is absent.uv run --frozen --extra test python -m pytest source/isaaclab/test/utils/test_configclass.py -q(45 passed)uv run --frozen python tools/changelog/cli.py check developuv run --frozen isaaclab -fChecklist
isaaclabchangelog fragment.