Skip to content

fix: make type annotations runtime-safe for bear-type compatibility#4973

Draft
mayankansys wants to merge 18 commits intomainfrom
fix/type_annotations_runtime_safe
Draft

fix: make type annotations runtime-safe for bear-type compatibility#4973
mayankansys wants to merge 18 commits intomainfrom
fix/type_annotations_runtime_safe

Conversation

@mayankansys
Copy link
Collaborator

Context

Several function signatures across the codebase annotated parameters as (Type = None) without including None in the type union. Static type-checkers like mypy accept this pattern silently, but runtime type-checkers such as beartype reject it — because None is not a valid instance of Type at evaluation time.

Change Summary

Annotations for all parameters defaulting to None were corrected to explicitly include None in their type (Type | None = None). The code generation template was updated to emit the corrected form. Deprecation decorators were hardened to preserve original function signatures through wrapper layers. Regression tests were added to guard against future regressions.

Impact

Runtime type-checking libraries can now be activated on the project without annotation-related failures. Introspection-based tooling (IDEs, documentation generators) will see accurate function signatures for decorated functions. Future code generation runs will automatically produce correct annotations.

@github-actions github-actions bot added the bug Issue, problem or error in PyFluent label Mar 4, 2026
@mayankansys mayankansys linked an issue Mar 4, 2026 that may be closed by this pull request
@github-actions github-actions bot added maintenance General maintenance of the repo (libraries, cicd, etc) dependencies Related to dependencies labels Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue, problem or error in PyFluent dependencies Related to dependencies maintenance General maintenance of the repo (libraries, cicd, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure support for runtime type-checking

3 participants