sublimelsp / LSP-ruff

LSP helper for ruff - an extremely fast Python linter, written in Rust.

Home Page:https://packagecontrol.io/packages/LSP-ruff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for Python 3.12

senpos opened this issue · comments

Hello!

When running this plugin with Python 3.12, it won't start, raising the following error:

LSP-ruff: Traceback (most recent call last):
LSP-ruff:   File "<frozen runpy>", line 198, in _run_module_as_main
LSP-ruff:   File "<frozen runpy>", line 88, in _run_code
LSP-ruff:   File "C:\Users\senpos\AppData\Local\Sublime Text\Package Storage\LSP-ruff\Scripts\ruff-lsp.exe\__main__.py", line 7, in <module>
LSP-ruff:   File "C:\Users\senpos\AppData\Local\Sublime Text\Package Storage\LSP-ruff\Lib\site-packages\ruff_lsp\__main__.py", line 5, in main
LSP-ruff:     from ruff_lsp import __version__, server
LSP-ruff:   File "C:\Users\senpos\AppData\Local\Sublime Text\Package Storage\LSP-ruff\Lib\site-packages\ruff_lsp\server.py", line 55, in <module>
LSP-ruff:     from pygls import server, uris, workspace
LSP-ruff:   File "C:\Users\senpos\AppData\Local\Sublime Text\Package Storage\LSP-ruff\Lib\site-packages\pygls\server.py", line 27, in <module>
LSP-ruff:     from pygls.lsp import ConfigCallbackType, ShowDocumentCallbackType
LSP-ruff:   File "C:\Users\senpos\AppData\Local\Sublime Text\Package Storage\LSP-ruff\Lib\site-packages\pygls\lsp\__init__.py", line 36, in <module>
LSP-ruff:     from typeguard import check_type
LSP-ruff:   File "C:\Users\senpos\AppData\Local\Sublime Text\Package Storage\LSP-ruff\Lib\site-packages\typeguard\__init__.py", line 27, in <module>
LSP-ruff:     from typing_extensions import Literal
LSP-ruff:   File "C:\Users\senpos\AppData\Local\Sublime Text\Package Storage\LSP-ruff\Lib\site-packages\typing_extensions.py", line 1174, in <module>
LSP-ruff:     class TypeVar(typing.TypeVar, _DefaultMixin, _root=True):
LSP-ruff: TypeError: type 'typing.TypeVar' is not an acceptable base type

This problem is specific to 3.12 and was also mentioned here: astral-sh/ruff-vscode#200

The solution was to update typing-extensions package to its latest version. As I can see, that's what authors do in ruff-vscode repository, they don't pin this package.

I suppose the dependabot that we use to bump dependencies in requirements.txt doesn't work quite as we would expect. It should ideally bump all the requirements to the ones that would match ruff-lsp but it doesn't do that...