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

Move typing imports and some definitions behind guard #2585

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nickdrozd
Copy link
Contributor

Type of Changes

Type
🔨 Refactoring

Description

Taking pylint-dev/pylint#9964 for a spin. Idea here is that imports that are only used for typechecking should only be imported for typechecking. This will clarify module dependency structure and possibly also reduce startup time and memory use. Pylint / Astroid is slow and complicated, so this sort of change will feed two birds with one scone.

Mostly this changes imports. There are also some type definitions that are used only for typechecking. The new checker doesn't look at those (yet), so they have not been systematically moved under the type guard. But ultimately they should be.

@nickdrozd nickdrozd force-pushed the unguarded-typing-import branch from 21defbc to 37f0fc5 Compare September 25, 2024 16:07
@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label Sep 25, 2024
@Pierre-Sassoulas
Copy link
Member

Lot of work on this one, nice 🔥 I'm going to benchmark this when I find the time

Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants