News for hackers. Stuff that matters.
Re:Kate and Python Language Server by josteink on Monday May 05, 2025 @03:40PM (#43898681)
As someone who recently set up something similar in Emacs with eglot I had to ditch Python-LSP-server.

It was so incredibly slow to respond, even on a M2 Max MBP, that it lowered my productivity by orders of magnitudes (and made Emacs laggy).

Maybe I did something wrong? I don’t know.

What I do know is that I tried pyright instead as a different LSP-server for Python and I haven’t looked back.

It’s a night and day difference. It’s snappy and everything works as expected, with venvs and mypy too.

Re:Kate and Python Language Server by kstrauser on Monday May 05, 2025 @03:54PM (#43898806)
I agree. I really wanted to like python-lsp-server (aka pylsp), but I felt it's kind of a mess getting everything set up and configured. Loathe as I was to configure a server running in Node to help my editor with Python code, it's far and away the best option I've found so far.

I do hope "ruff server" will do for Python LSPs what ruff did for linting and formatting.

Re:Kate and Python Language Server by nerdponx on Monday May 05, 2025 @05:07PM (#43899466)
I haven't tried the Ruff server yet, but Jedi Language Server is usably fast, and does a good enough job.
Re:Kate and Python Language Server by kstrauser on Monday May 05, 2025 @05:30PM (#43899643)
Jedi's very nice for refactoring and auto-completion! I get more value from linting and type checking, though, and Jedi doesn't handle those. Pairing it with something like pyright is a great combination if your editor lets you connect to multiple servers.
Re:Kate and Python Language Server by kristjansson on Monday May 05, 2025 @05:24PM (#43899597)
It's not ready yet, but https://pyrefly.org/ might be a good competitor/complement in the future
Re:Kate and Python Language Server by tiltowait on Monday May 05, 2025 @07:06PM (#43900268)
Looks promising! It doesn't work with my poetry environment, but I like what I see so far. Definitely something to watch.
Re:Kate and Python Language Server by team_pyrefly on Thursday May 08, 2025 @10:44AM (#43926532)
Hi! I'm on the team behind Pyrefly. Thanks for taking a look and raising the need for poetry support. We added a GitHub issue to track that here: https://github.com/facebook/pyrefly/issues/166
Re:Kate and Python Language Server by arccy on Monday May 05, 2025 @04:06PM (#43898914)
last time i looked the people were recommending basedpyright: https://github.com/DetachHead/basedpyright
Re:Kate and Python Language Server by Hasnep on Monday May 05, 2025 @06:49PM (#43900186)
I've been recommending it whenever Pylance comes up on HN or Lobsters, the docs explain how to set it up on the most popular editors: https://docs.basedpyright.com/dev/installation/ides
Re:Kate and Python Language Server by wormius on Monday May 05, 2025 @03:49PM (#43898759)
Not particularly relevant to the core article, but just a dumb thought re: the LSP/LS annoyance mentioned in the intro.

I think maybe some of it stems from 'ls' the command. If I saw something called py-ls instead of py-lsp, I may think it's a python based ls command. "Name Collision" as it were.

Anyways off to read the rest of the article...

Re:Kate and Python Language Server by ogoffart on Tuesday May 06, 2025 @01:10AM (#43901992)
I wrote a language server too, and I also went with "-lsp" naming because it's way more recognizable. "LSP" is kind of a brand. If you look at the list at https://microsoft.github.io/language-server-protocol/impleme... a lot of them are named -lsp.
Re:Kate and Python Language Server by dundarious on Tuesday May 06, 2025 @12:13AM (#43901753)
Please quote your variable expansions in bash. Otherwise, spaces, etc., will lead to issues.

It would also make sense to use path after it is defined, instead of sometimes using `$1` again.

And I'm confused by `cd`ing into `$path` but then checking paths that are prefixed by `$path`... I assume that is an error, and you won't run it like `script.sh ./work/project` and expect a path like `./work/project/work/project` or `./work/project/project` to exist.

  #!/usr/bin/env bash
  path="$1"
  if [ -d "$path/.venv" ]; then
    source "$path/.venv/bin/activate"
  fi
  if [ -d "$path/venv" ]; then
    source "$path/venv/bin/activate"
  fi
  cd "$path"
  exec pylsp --check-parent-process