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

pyls does not work on Python 3.11 #1300

Open
Akuli opened this issue Jun 27, 2023 · 10 comments
Open

pyls does not work on Python 3.11 #1300

Akuli opened this issue Jun 27, 2023 · 10 comments

Comments

@Akuli
Copy link
Owner

Akuli commented Jun 27, 2023

Porcupine uses pyls as the default langserver for Python. It does not work at all on Python 3.11. This means that you don't get jump-to-definition or reasonable autocompletions, unless you run Porcupine on an older python version.

I really should consider switching to pyright (#560)

@rdbende
Copy link
Collaborator

rdbende commented Jun 27, 2023

Yup, besides pyls I can say that everything works fine on 3.11, I've been using it for about half a year when Debian unstable got it.

@benjamin-kirkbride
Copy link
Contributor

Do we know which tests are expected to fail as a result of this? Can we conditionally xfail and/or skip them for now?

@benjamin-kirkbride
Copy link
Contributor

These tests fail for me with python 3.11, but it's possible there are other factors at play:

FAILED tests/test_indent_dedent.py::test_markdown_autoindent - AssertionError: assert '1. Lol and\n...\nEnd of list' == '1. Lol and\n...\nEnd of list'
FAILED tests/test_jump_to_definition_plugin.py::test_basic - RuntimeError: timed out waiting
FAILED tests/test_jump_to_definition_plugin.py::test_two_definitions - RuntimeError: timed out waiting
FAILED tests/test_rstrip_plugin.py::test_rstrip - assert 'print("hello") ' == 'print("hello")\n'
FAILED tests/test_tabs.py::test_read_only_file - ValueError: too many values to unpack (expected 1)
ERROR tests/test_jump_to_definition_plugin.py::test_basic - ValueError: error in tkinter callback while running test
ERROR tests/test_jump_to_definition_plugin.py::test_two_definitions - ValueError: error in tkinter callback while running test

@Akuli
Copy link
Owner Author

Akuli commented Jul 1, 2023

I think only the test_jump_to_definition_plugin.py failures are caused by this. If you xfail them, it would be nice if you made a PR about it, and also add 3.11 to version lists in .github/workflows/ so that CI tests it with the xfails :)

@benjamin-kirkbride
Copy link
Contributor

Upstream issue: palantir/python-language-server#959

@benjamin-kirkbride
Copy link
Contributor

I think we should consider switching to https://github.com/python-lsp/python-lsp-server

Pyright is not really a replacement for pyls; it is just a static type checker (Mypy replacement). The VSCode/Microsoft LSP that does auto-completion, refactoring, etc is pylance which is not open source (or usable outside of VSCode at all).

@Akuli
Copy link
Owner Author

Akuli commented Aug 8, 2023

I am aware that pyright and pylance are not the same, but pyright also has a langserver that gives autocompletions and such. It is usable without pylance, and probably enough for Porcupine without pylance.

At least this is my understanding of pyright's langserver. Feel free to prove me wrong :)

@benjamin-kirkbride
Copy link
Contributor

Huh, you appear to be correct: https://microsoft.github.io/pyright/#/features?id=language-server-support

I do wonder then what Pylance does that Pyright doesn't.

@benjamin-kirkbride
Copy link
Contributor

That said, I prefer Mypy to Pylance pretty strongly for type checking specifically, so if possible I would vote that we retain Mypy support regardless of what language server we go with :)

@rdbende
Copy link
Collaborator

rdbende commented Aug 9, 2023

Mypy support would be retained of course, the same way as you can use it now: open the run dialog and run Mypy from there.
However, for type checking Porcupine itself we'd like to switch to Pyright.

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

No branches or pull requests

3 participants