Skip to content

Standardize configclass type metadata - #6923

Open
TWpoint wants to merge 3 commits into
isaac-sim:developfrom
TWpoint:twpoint/standardize-configclass-typing
Open

Standardize configclass type metadata#6923
TWpoint wants to merge 3 commits into
isaac-sim:developfrom
TWpoint:twpoint/standardize-configclass-typing

Conversation

@TWpoint

@TWpoint TWpoint commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • Replace the legacy Pylance-specific identity marker with typing.dataclass_transform.
  • Preserve the decorated class type through a generic configclass signature.
  • Add regression coverage for the standard PEP 681 metadata.

Motivation

The existing helper predates the standardized typing.dataclass_transform API. 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, so configclass can use the standard decorator directly and provide portable metadata to modern type checkers.

Validation

  • Verified the new regression test fails against the old implementation because 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 develop
  • uv run --frozen isaaclab -f

Checklist

  • I have read and understood the contribution guidelines.
  • I have run the pre-commit checks.
  • Documentation changes are not required for this internal typing fix.
  • The changes generate no new warnings.
  • I have added a regression test that fails without the fix.
  • I have added an isaaclab changelog fragment.

Replace the legacy Pylance marker with the standard PEP 681 decorator so type checkers can preserve decorated class types and infer dataclass behavior.
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Aug 5, 2026
@TWpoint
TWpoint marked this pull request as ready for review August 5, 2026 18:59
@TWpoint
TWpoint requested a review from a team August 5, 2026 18:59
@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR replaces the legacy type-checker-specific marker with standard PEP 681 metadata while preserving the decorated class type through a generic signature.

  • Applies typing.dataclass_transform directly to configclass.
  • Adds runtime regression coverage for the standard transform metadata defaults.
  • Adds a changelog fragment documenting improved static type inference.

Confidence Score: 5/5

The 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

Filename Overview
source/isaaclab/isaaclab/utils/configclass.py Replaces the inert legacy marker with standard dataclass-transform metadata and a type-preserving generic decorator signature without changing runtime configuration behavior.
source/isaaclab/test/utils/test_configclass.py Adds focused regression assertions for the PEP 681 metadata exposed by configclass.
source/isaaclab/changelog.d/twpoint-configclass-typing.rst Accurately documents the static type-inference fix.

Reviews (1): Last reviewed commit: "Remove contributor list update" | Re-trigger Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_transform preserves the existing runtime decorator path while making its dataclass-like behavior portable to type checkers. The metadata should also model the supported dataclasses.field/Field constructs so static analysis matches actual configuration-class semantics.
  • API: The @configclass calling convention and decorated class identity are preserved by the type[_T] -> type[_T] signature. However, the public typing contract currently leaves field_specifiers empty, so options such as init=False and kw_only=True are not represented to PEP 681 consumers.
  • Implementation: The runtime implementation remains unchanged, and the metadata regression test covers the default transform flags. Add dataclasses.field and dataclasses.Field to field_specifiers and extend the metadata test accordingly, matching the field usage already documented and supported by configclass.

Minor fixes needed. Posted 1 actionable finding inline.

Automated review; human maintainers own approval decisions.

Comment thread source/isaaclab/isaaclab/utils/configclass.py Outdated
TWpoint added a commit to TWpoint/IsaacLab that referenced this pull request Aug 5, 2026
Carry the net change from upstream PR isaac-sim#6923 on the downstream integration branch so configclass exposes standard PEP 681 metadata.
TWpoint added a commit to TWpoint/IsaacLab that referenced this pull request Aug 6, 2026
Carry the net change from upstream PR isaac-sim#6923 on the downstream integration branch so configclass exposes standard PEP 681 metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant