You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type hints have been available in Python since 3.5. They have no impact on code execution, but can aid IDEs for autocompletion. OpenMDAO should add some hints for certain attributes and methods for which introspection is difficult.
For the first round of type hinting, OpenMDAO should provide hints for:
And Group.add_subsystem, which returns the same type input
T = TypeVar("T", bound="System")
def self.add_subsystem(self, subsys=typing.Type[T], ...) -> T:
Note that the build-in function type replaces typing.Type as of 3.8, but we still support older versions.
Testing
Various linters are available to detect that these types are being applied correctly. mypy is common for static analysis, but others are available and may work better in our CI system.
Associated POEM
N/A
The text was updated successfully, but these errors were encountered:
Desired capability or behavior.
Type hints have been available in Python since 3.5. They have no impact on code execution, but can aid IDEs for autocompletion. OpenMDAO should add some hints for certain attributes and methods for which introspection is difficult.
For the first round of type hinting, OpenMDAO should provide hints for:
Problem.driver: typing.Type[Driver]
Problem.model: typing.Type[System]
Sytem.nonlinear_solver: typing.Type[NonlinearSolver]
System.linear_solver: typing.Type[LinearSolver]
NonlinearSolver.linesearch: typing.Type[LinesearchSolver]
And
Group.add_subsystem
, which returns the same type inputNote that the build-in function
type
replacestyping.Type
as of 3.8, but we still support older versions.Testing
Various linters are available to detect that these types are being applied correctly.
mypy
is common for static analysis, but others are available and may work better in our CI system.Associated POEM
N/A
The text was updated successfully, but these errors were encountered: