Skip to content

Check for no side-effects during import #4056

@worldmind

Description

@worldmind

Initial issue: ruff removed imports which looks unused, but they are actually needed and to be honest I also tried to remove those imports and realized they are needed only after tests starts failing.
That gave me idea, but I am not sure is it even possible to implement, if it's fully stupid question just close it.
I am wondering about check that there is no side effects during import: usually when you do import you just want to bring some names to current namespace, but in practice sometimes, in addition to that, you can get some side-effects, for example if you are using django's receiver decorator in imported file, import will also register django signal handler(s).
As for me, good practice is not having any side-effects, so, if it's possible good to have such check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions