Do you use an LSP for python ? If so, which one ?

I just discovered basedpyright. NUTS. It is hands down the best open source experience I have had developing in this infuriatingly promiscuous language with no concern for runtime safety (I understand the historical reasons... I am just sad it has become the defacto standard for my field).

#python #languageserverProtocol #lsp #emacs #basedPyright

pylsp (python-lsp-server)
30%
pyright
15%
basedpyright
25%
pylance
0%
Other (please tell us more!)
30%
Poll ended at .

Let's say you want to do good type-checking for the #Python project you're working on. You pick a tool, maybe you use it as an #LSP also (so your editor can show you errors, too). As an example, I'm using #Ty at the moment. There's three places this might be installed: globally (e.g., `brew install ty`), as a dev-only dependency inside your project (e.g., `uv add --dev ty`), or -- and this one might surprise you -- it might only be used and installed by `pre-commit`, which builds a separate environment for each needed tool (which is great for instance where I use `codespell` as a `pre-commit` check, which seems to need some higher version of Python than my actual project).

Where should you install it?

If you're the only one on your team running it, globally is fine. If more than just you, then absolutely as a dev-only dependency inside your project ... and **maybe** globally as well.

The only real problem is updates. If you use a reasonable global install scheme, updates will be easy. They're less easy inside your project or in `pre-commit`. And you might care one way or the other! I **don't** want updates! I **do** want updates!

As for Python type-checking, `ty` seems good so far, but not enough experience with it yet. `basedpyright`, `pyrefly`, and `ruff` all good. These four are my favorites.

#BasedPyright #Pyrefly #Ruff #PreCommit #CodeSpell #Homebrew

Well … I get symbol renaming if I use #BasedPyright as my #LSP

#Pyrefly #AdventOfCode

@feoh Yup. For me its way better than #pyright or #basedpyright.

Just installed #basedpyright in #vscode to replace pyright and pylance. So far I'm loving it.
It gives me better docstring support, better auto imports and possibly other things I haven't found out yet!

https://docs.basedpyright.com/latest/

basedpyright

Kushal Das

FOSS and life. Kushal Das talks here.

Kushal Das
https://github.com/sbdchd/django-types/blob/main/README.md contains a lot of interesting things which one should do for proper #type #checking on #django projects. #pyright #basedpyright #python
django-types/README.md at main Β· sbdchd/django-types

:doughnut: Type stubs for Django. Contribute to sbdchd/django-types development by creating an account on GitHub.

GitHub

I documented my #emacs setup for #python using #basedpyright. (The trick is getting basedpyright to find your venv. The rest is straightforward.)

https://webbureaucrat.gitlab.io/articles/emacs-for-python-and-poetry-using-basedpyright-langserver/

Emacs for Python and Poetry Using `basedpyright-langserver`