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

Remove "import *" #67

Open
rpoleski opened this issue Dec 12, 2022 · 7 comments
Open

Remove "import *" #67

rpoleski opened this issue Dec 12, 2022 · 7 comments
Labels
help wanted quick_fix something to be fixed easily and quickly

Comments

@rpoleski
Copy link
Owner

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.

@rpoleski rpoleski added the quick_fix something to be fixed easily and quickly label Dec 12, 2022
@jenniferyee
Copy link
Collaborator

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

@rpoleski
Copy link
Owner Author

rpoleski commented Oct 7, 2023

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?

@ketozhang
Copy link
Contributor

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

Looks good to me.

@rapoliveira
Copy link
Contributor

@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?

@rpoleski
Copy link
Owner Author

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?

@ketozhang
Copy link
Contributor

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)

@rpoleski
Copy link
Owner Author

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.

rapoliveira added a commit to rapoliveira/MulensModel that referenced this issue Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted quick_fix something to be fixed easily and quickly
Projects
None yet
Development

No branches or pull requests

4 participants