Skip to content

Remove star imports from init modules #39

@MArpogaus

Description

@MArpogaus

Description

Hello @francois-rozet,

This should take up our discussion on the usage of star imports in #38:

Using star imports in Python is very convenient and saves you from typing long module names repeatedly if you need to use multiple entities from a module.
However, from my experience, star imports can cause naming conflicts if two modules have entities with the same name. Importing everything from a module can make it difficult to determine which specific entities are being used in the code. This can make code more error-prone and harder to debug. Additionally, Linters like ruff cant warn you about unused imports when start imports are used.

Hence, I would suggest removing them from the init modules for the reasons mentioned above, at the cost of slightly higher maintenance.

Implementation

I did originally eliminate the use of all start import in commit 08d3f43.
If desired, I could cherry-pick zuko/flows/__init__.py from commit 08d3f43 and remove the ignores from pyprojetc.toml in a new PR.

Alternatives

Leave everything as it is now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions