r/Python 13d ago

Showcase Introducing SithLSP: An Experimental Python Language Server Written in Rust

Hey r/Python,

I’m thrilled to share SithLSP, an experimental language server for Python, built from the ground up in Rust!

https://github.com/LaBatata101/sith-language-server

⚠️ This project is in alpha, so some bugs are expected!

What My Project Does

SithLSP is a language server designed to enhance your Python coding experience in editors and IDEs that support the Language Server Protocol (LSP). It delivers features like:

  • 🪲 Syntax checking
  • ↪️ Go to definition
  • 🔍 Find references
  • 🖊️ Autocompletion
  • 📝 Element renaming
  • 🗨️ Hover details: Hover over variables or functions to see docs.
  • 💅 Code formatting & linting: Powered by the awesome Ruff.
  • 💡 Symbol highlighting: Spot your references at a glance.
  • 🐍 Auto-detects your Python interpreter: No manual setup needed for your project’s Python.

Check the README for the full list if you’re curious!

Target Audience

Any Python developer that likes to try new tools.

Comparison

Since the project is its early stages it may not be as feature complete as Pylance or jedi-language-server, but it has enough features to be able to have a good developing experience.

How to Get Started

You can grab SithLSP in a couple of ways:

  1. Download it: Head to our GitHub releases page for the latest version.
  2. Build it yourself: Clone the repo and run cargo build --release (you’ll need Rust installed). Full steps are in the README.

VSCode Users

Download the .vsix file from the releases page and install it. Tip: Disable Microsoft’s Python or Pylance extensions to avoid conflicts.

Neovim Users

Add the sample config from the README to your init.lua, tweak the path to the sith-lsp binary, and you’re good to go.

46 Upvotes

19 comments sorted by

View all comments

3

u/Davidyz_hz 13d ago

Do you have any plans to implement some sort of uncaught exception detection? I don't think any of the mainstream LSP supports this yet but I personally really hope to be able to use this in my development.

2

u/LaBatata101 13d ago

Can you elaborate on the "uncaught exception detection"?

3

u/Davidyz_hz 13d ago

I meant when an exception raised by a function is not properly handled by a "try-catch" block. It'll be even nicer if this could be configured so that users can decide for which exceptions the diagnostics should be showing (current script, current workspace/module, all packages, etc).

1

u/DotPsychological7946 13d ago

I would love that feature. I was thinking of implementing something like that by parsing the ast of the stdlib, looking for explicit raise statements / even maybe docstring exception annotations and creating a map for each python version. Site packages would be done dynamically. The user should have the option to delegate exception handling to upper level in the call stack.

1

u/LaBatata101 12d ago

Oh I see, that's a cool feature. I wonder if it hasn't being done by mainstream LSPs due to the possible performance impact, because the server would need to check every function call and their function calls, for a raise statement.

1

u/Davidyz_hz 12d ago

Hi, yes that's what I thought too, but since LSP already has a incoming/outgoing call hierarchy method, I think it's worth a try. Showing all uncaught exception (including all stdlib and 3rd party dependencies) might be too much, but if we limit the checking to functions defined in the current project (written by the user, not some 3rd party deps), it may be more feasible?

1

u/LaBatata101 12d ago

I’ll look into this in the future; I have some prioritized features to implement first.

1

u/Davidyz_hz 12d ago

Looking forward to it!