Skip to content

Conversation

superbobry
Copy link
Contributor

The flag forces all values to be rendered as ..., which is usually what you want in a .pyi file.

The motivating use-case in JAX was version attributes, which are currently rendered as

foo_version: int = 42

so every version bump will be unnecessarily reflected in the .pyis.

@wjakob
Copy link
Owner

wjakob commented Oct 10, 2025

Could you document this flag and also expose it in the CMake stubgen?

@superbobry
Copy link
Contributor Author

All done!

I couldn't think of a good one-letter flag name for --exclude-values, so I documented it as is -- the long form only.

s = f'{tv}("{e.__name__}"'
for v in getattr(e, "__constraints__", ()):
v = self.expr_str(v)
v = self.type_str(v)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I switched to type_str here and below because both constraints and bound are type expressions as per the typing spec.

@wjakob
Copy link
Owner

wjakob commented Oct 17, 2025

Hi @superbobry -- all of these look good to me. However, could I ask you to split this into 2 PRs? (EXCLUDE_VALUES, and then a separate PR for the typing stuff, each squashed).

The flag forces all values to be rendered as ..., which is usually what
you want in a .pyi file.

The motivating use-case in JAX was version attributes, which are currently
rendered as

    foo_version: int = 42

so every version bump will be unnecessarily reflected in the .pyis.
@superbobry
Copy link
Contributor Author

Sure, forked off typing.ParamSpec changes into #1194.

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