hezarai / hezar

The all-in-one AI library for Persian, supporting a wide variety of tasks and modalities!
https://hezarai.github.io/hezar/
Apache License 2.0
838 stars 45 forks source link

Wildcard imports are bad practice! #30

Closed arxyzan closed 1 year ago

arxyzan commented 1 year ago

As it's mentioned in Python docs, wildcard imports are not good practice! Nevertheless this can be seen in most of the well-known open source projects. As of now in Hezar, we do it this way: In every submodule import everything explicitly if the submodule or file has less than 5ish properties, otherwise provide the needed properties in __all__ and import with wildcards. You can see this style mostly in utils and other files that contain a lot of classes, methods, etc because otherwise it'd be easy to miss some of them as we move forward. Also, IDEs and editors automatically warn the developer if new stuff are not added to __all__.

arxyzan commented 1 year ago

The above method seems like a good practice for now.