Skip to content

ImportError: cannot import name 'Any' from 'typing_extensions' #1995

@dcambie

Description

@dcambie

Since #1831 textual uses typing_extensions.Any (e.g. in actions.py#L6).

Any was introduced in typing_extensions 4.4.0, (see changelog) however, the minimum version of typing_extensions required by textual in the pyproject.toml seems to be 4.0.0.

This creates the following error when textual is installed in a venv where typing_extensions is already present with version higher than 4.0 but lower than 4.4.

Traceback:

C:\Users\cambie\PycharmProjects\flowchem\venv\Scripts\python.exe C:\Users\cambie\PycharmProjects\flowchem\docs\_static\tree_figure.py 
Traceback (most recent call last):
  File "C:\Users\cambie\PycharmProjects\flowchem\docs\_static\tree_figure.py", line 1, in <module>
    from textual.app import App, ComposeResult
  File "C:\Users\cambie\PycharmProjects\flowchem\venv\lib\site-packages\textual\app.py", line 50, in <module>
    from . import Logger, LogGroup, LogVerbosity, actions, events, log, messages
  File "C:\Users\cambie\PycharmProjects\flowchem\venv\lib\site-packages\textual\actions.py", line 6, in <module>
    from typing_extensions import Any, TypeAlias
ImportError: cannot import name 'Any' from 'typing_extensions' (C:\Users\cambie\PycharmProjects\flowchem\venv\lib\site-packages\typing_extensions.py)

Fixed locally by pip install -U but asking for the obvious fix of bumping the dep. Congrats on the great library btw ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions