grape icon indicating copy to clipboard operation
grape copied to clipboard

Question regarding the main GRAPE module import

Open RemyLau opened this issue 2 years ago • 1 comments

Hi! One minor question/suggestion: I'm wondering if it would be a better idea not to load all modules as is done right now. For example, when I want to load from the local module utils.py, it fails because utils was taken by ensmallen. One way I've tried to work around this is to pop the automatically loaded ensmallen utils module by sys.modules.pop['utils'].

https://github.com/AnacletoLAB/grape/blob/788e195de118d7539ae729a980b497f47eff99ee/grape/init.py#L13-L30

Would it be better to simply do the following instead of importing everything?

import embiggen
import ensmallen

__all__ = ["embiggne", "ensmallen"]  # or add whatever top level modules that make sense

RemyLau avatar Mar 12 '23 01:03 RemyLau

Hi @RemyLau! I am thinking about some alternative ways to bypass this issue. The complex import procedure was designed to resolve directly the sub-packages, without having to add the middle call, which I found tedious. Which feature would you like to import from utils? We'll find a solution.

LucaCappelletti94 avatar Mar 30 '23 19:03 LucaCappelletti94