Skip to content

**kwargs hiding important attributes from new users #1306

Description

@Tmodrzyk

Documentation location

https://deepinv.org/api/stubs/deepinv.physics.Blur.html, https://deepinv.org/api/stubs/deepinv.physics.LinearPhysics.html#deepinv.physics.LinearPhysics

Describe the issue or suggestion

We use **kwargs to pass in parameters to the constructor of child classes to their parent classes, which is common practice.
However, this hides important attributes in the documentation: for instance Blur has the noise_model attributes, like all LinearPhysics, but it does not appear in the documentation nor in the function's prototype.
This can hide this information from new users who might not think about looking at the documentation of the parent class.
Another consequence is that these inherited attributes / parameters are hidden from Pylance.
Most users using modern IDEs will either hover their mouse above function description, or auto-complete the function call with the parameters. Both uses Pylance, which will not give any information about the inherited attributes in **kwargs.

Suggested fix or improvement (optional)

A possible solution is to use TypedDict (https://deepinv.org/api/stubs/deepinv.physics.LinearPhysics.html#deepinv.physics.LinearPhysics) and define a set of attributes that should always be visible for classes inheriting from LinearPhysics.

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreInternal project work - CI, tests, typing, docs build, packaging, or releasespriority: lowNice to have, non-urgent issue or PR.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions