from packaging._typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import ... Ref: https://github.com/python/mypy/issues/3216 Fé