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

Module-scoped imports #3464

Merged
merged 4 commits into from
Nov 9, 2023
Merged

Module-scoped imports #3464

merged 4 commits into from
Nov 9, 2023

Conversation

janosh
Copy link
Member

@janosh janosh commented Nov 9, 2023

Follow up to #3462.

@janosh janosh added linting Linting and quality assurance housekeeping Moving around or cleaning up old code/files labels Nov 9, 2023
@shyuep
Copy link
Member

shyuep commented Nov 9, 2023

There are good reasons to not use module scope in many instances. E.g., when a function is rarely used.

…tion' from partially initialized module 'pymatgen.transformations.advanced_transformations'
@janosh
Copy link
Member Author

janosh commented Nov 9, 2023

There are 2 more conditions for it to make sense to have function-scoped imports. The import must be expensive and not already in the import tree. I'm looking out for that in these refactors but those 3 conditions almost never coincide.

@janosh janosh merged commit 605757f into master Nov 9, 2023
22 checks passed
@janosh janosh deleted the module-scoped-imports branch November 9, 2023 18:39
@janosh janosh added imports Import changes and formatting and removed linting Linting and quality assurance labels Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Moving around or cleaning up old code/files imports Import changes and formatting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants