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

typing_extensions needed for Python 3.7 #674

Closed
1 task done
dejanceltra opened this issue Oct 7, 2021 · 3 comments
Closed
1 task done

typing_extensions needed for Python 3.7 #674

dejanceltra opened this issue Oct 7, 2021 · 3 comments
Labels
🐛 bug Something isn't working

Comments

@dejanceltra
Copy link

  • I have searched the issue tracker and believe that this is not a duplicate.

pdm doesn't have typing_extensions specified as a dependency, but it's needed for Python 3.7:

pdm/pdm/_types.py

Lines 4 to 9 in 1f83b7e

if sys.version_info >= (3, 8):
from importlib.metadata import Distribution
from typing import Literal, Protocol, TypedDict
else:
from importlib_metadata import Distribution
from typing_extensions import Literal, Protocol, TypedDict

Steps to reproduce

$ /usr/local/python3.7/bin/pip install pdm==1.8.5
$ /usr/local/python3.7/bin/pdm

Actual behavior

$ /usr/local/python3.7/bin/pdm
Traceback (most recent call last):
  File "/usr/local/python3.7/bin/pdm", line 5, in <module>
    from pdm.core import main
  File "/usr/local/python3.7/lib/python3.7/site-packages/pdm/__init__.py", line 5, in <module>
    from pdm.cli.commands.base import BaseCommand
  File "/usr/local/python3.7/lib/python3.7/site-packages/pdm/cli/commands/base.py", line 5, in <module>
    from pdm.cli.options import Option, global_option, project_option, verbose_option
  File "/usr/local/python3.7/lib/python3.7/site-packages/pdm/cli/options.py", line 9, in <module>
    from pdm._types import Protocol
  File "/usr/local/python3.7/lib/python3.7/site-packages/pdm/_types.py", line 9, in <module>
    from typing_extensions import Literal, Protocol, TypedDict
ModuleNotFoundError: No module named 'typing_extensions'
@dejanceltra dejanceltra added the 🐛 bug Something isn't working label Oct 7, 2021
@blueyed
Copy link
Contributor

blueyed commented Oct 7, 2021

Might be worth only importing it with/for typing.TYPE_CHECKING

@frostming
Copy link
Collaborator

Can you double check the dependency tree? since typing-extensions is required by importlib-metadata, which is required on Python < 3.8

@pawamoy
Copy link
Contributor

pawamoy commented Oct 7, 2021

@frostming I think you shouldn't rely on a package being a dependency of another dependency. If you import it directly, list it as a dependency. This could prevent bad surprises :) And it gives you control over the accepted versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants