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

Release 2.6.1 fails on import on Python < 3.8 w/o typing extensions #122

Closed
amacf opened this issue Dec 28, 2022 · 0 comments · Fixed by #123
Closed

Release 2.6.1 fails on import on Python < 3.8 w/o typing extensions #122

amacf opened this issue Dec 28, 2022 · 0 comments · Fixed by #123

Comments

@amacf
Copy link
Contributor

amacf commented Dec 28, 2022

If you import platformdirs on python < 3.8, it now fails with release 2.6.1 unless you have the typing-extensions package already installed.

I think the issue is this change in release 2.6.1: 2.6.0...2.6.1#diff-e6813e0402941ad4943c8261f1ecfe5e1f9ccd55cb009b996fd785f3637fc7c2

I would suggest it should be:

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    if sys.version_info >= (3, 8):  # pragma: no cover (py38+)
        from typing import Literal
    else:  # pragma: no cover (py38+)
        from typing_extensions import Literal

Alternatively, typing_extensions should be added as a dependency

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

Successfully merging a pull request may close this issue.

1 participant