Skip to content

Fix the use of wildcard import sign (*) in all __init__.py files #557

@mraffly

Description

@mraffly

Purpose of the improvement

This refers to point 5.1 in the documentation https://iffmd.fz-juelich.de/zXxTrardSNaJc4a22gNypw?view

When it comes to importing, wildcard import sign is used in all init.py, such as this line in

from .subclasses import *

Example from fine/init.py

from .subclasses import *
from .IOManagement import *
from .aggregations import *

This can cause the following issues:

  • Makes it unclear which symbols are exported
  • Can lead to namespace pollution
  • Harder to track where imports come from
  • Ruff linter specifically ignores F403 (wildcard import warnings) in config

Proposal

Hence, fixing this is desirable (if necessary) and could be done by doing so:

  • Define explicit all lists in each module
  • Or migrate to explicit imports in init.py files
  • Note: This is a large refactor affecting the entire project structure

NOTES:

Do we want to prevent wildcard imports?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions