-
Notifications
You must be signed in to change notification settings - Fork 489
Closed
Description
Hey -- so we vendor this library over in pipenv and I recently updated to the latest release before realizing that there is now a hard dependency on typing. We don't vendor typing and I'd rather avoid that, but it's also not strictly necessary to put unguarded typing imports everywhere. They are slow, for one thing, or they can be, and they break on systems where typing isn't available.
What I often do is include a utility method that sets a variable if the type checker is running, something like this (in utils.py or environment.py):
def is_type_checking():
try:
from typing import TYPE_CHECKING
except ImportError:
return False
return TYPE_CHECKING
IS_TYPE_CHECKING = os.environ.get("MYPY_RUNNING", is_type_checking())If that solution makes sense here, I'm happy to PR it. I'll open a PR and feel free to merge or close as needed
Metadata
Metadata
Assignees
Labels
No labels