rpoleski / MulensModel

Microlensing Modelling package

Home Page:https://rpoleski.github.io/MulensModel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove "import *"

rpoleski opened this issue · comments

It's a bad practice to do "import *" in python. It can be replaced using specific imports or using __all__ in imported files. We should remove "import *" from __init__.py and mulensobjects/__init__.py.

I'm unassigning myself, because I don't know how to fix this.

I'm trying to remove import * commands in the import_no_star branch.
@justi @ketozhang Could you please have a look and let me know if I'm not introducing any bugs in this way?

I've skimmed through it and ran the repository through the ruff linter.

Looks good to me.

@rpoleski I see that you started doing it in a specific branch.
Currently, there are import * left only in __init__.py and mulensobjects/__init__.py? Should I keep using your branch then?

Dear @ketozhang, I've already forgotten about this discussion and branch linked above. There are multiple similar changes like:
from MulensModel.binarylens import BinaryLens
->
from .binarylens import BinaryLens
Is there any preference for either of them?

No, not if the file using the import statement lives inside the package.

It's a stylistic preference (despite the misunderstood caution to avoid it)

Thanks.
In that case, @rapoliveira please make a new branch and correct __init__.py and mulensobjects/__init__.py there. Branch import_no_star will be deleted.