jupyterlab / jupyter-ai

A generative AI extension for JupyterLab
https://jupyter-ai.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
3.22k stars 325 forks source link

Server-side error on Python 3.8 #838

Closed krassowski closed 4 months ago

krassowski commented 4 months ago

Description

      File "python3.8/site-packages/jupyter_ai/__init__.py", line 3, in <module>
        from jupyter_ai_magics import load_ipython_extension, unload_ipython_extension
      File "python3.8/site-packages/jupyter_ai_magics/__init__.py", line 4, in <module>
        from .embedding_providers import (
      File "python3.8/site-packages/jupyter_ai_magics/embedding_providers.py", line 3, in <module>
        from jupyter_ai_magics.providers import (
      File "python3.8/site-packages/jupyter_ai_magics/providers.py", line 212, in <module>
        class BaseProvider(BaseModel, metaclass=ProviderMetaclass):
      File "python3.8/site-packages/jupyter_ai_magics/providers.py", line 280, in BaseProvider
        server_settings: ClassVar[Optional[MappingProxyType[str, Any]]] = None
    TypeError: 'type' object is not subscriptable

Reproduce

Install on python 3.8

Expected behavior

Works with minimum dependencies installed.

Context

Mea culpa

krassowski commented 4 months ago

Python 3.8 is still supported for 3 more months (https://devguide.python.org/versions/).

I've tried adding from future import __annotations__ but this does not seem to help.

However, changing the type annotation to ClassVar[Optional[MappingProxyType]] does help. Maybe it is ok to simplify?