Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wildcard imports in __init__.py #373

Closed
poldrack opened this issue May 31, 2022 · 1 comment
Closed

wildcard imports in __init__.py #373

poldrack opened this issue May 31, 2022 · 1 comment

Comments

@poldrack
Copy link
Contributor

Describe the bug
Wildcard imports are widely agreed upon as a no-no in Python (see e.g. here or here). They are particularly bad when placed inside an init.py file because most people don't think to look there, and it can thus be very difficult to track down the location of an imported file. E.g. I was trying to find utils._int_antsProcessArguments only to see that it was imported through one of the wildcard imports within the utils directory, so I have no idea where it came from without searching through all those files (obviously not difficult, but annoying). and if I wasn't already attentive to look for this antipattern I would have been really confused!

Expected behavior
all imports should be explicit.

@ncullen93
Copy link
Member

Thanks for this suggestion! I've addressed this for the sub-modules in a new PR #533 . It's hard to make this change in the top-level init.py file without having a massive unreadable file.

Let me know if you have any other suggestions re: best practices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants