Skip to content

Add basedpyright language server support#1240

Open
arikon wants to merge 1 commit intooraios:mainfrom
arikon:add-basedpyright-support
Open

Add basedpyright language server support#1240
arikon wants to merge 1 commit intooraios:mainfrom
arikon:add-basedpyright-support

Conversation

@arikon
Copy link
Copy Markdown
Contributor

@arikon arikon commented Mar 29, 2026

Summary

  • Add basedpyright as an alternative Python language server (experimental)
  • basedpyright is a fork of pyright with additional features and stricter type checking
  • Follows the same integration pattern as the existing pyright server

Changes

  • New BasedPyrightServer class in src/solidlsp/language_servers/basedpyright_server.py
  • PYTHON_BASEDPYRIGHT enum value in Language (marked as experimental)
  • basedpyright==1.38.4 added as a bundled dependency
  • Test repo alias and pytest marker added

Usage

In .serena/project.yml:

languages:
- python_basedpyright

Test plan

  • Existing Python tests pass (pytest test -m python — 53 passed)
  • ruff lint and format pass
  • mypy type check passes (no new errors)

🤖 Generated with Claude Code

Add basedpyright (a fork of pyright with additional features) as an
alternative Python language server. It follows the same pattern as the
existing pyright integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@MischaPanch
Copy link
Copy Markdown
Contributor

Hi. We already support multiple python LS, including ty. What's the purpose of also supporting basedpyright?

@arikon
Copy link
Copy Markdown
Contributor Author

arikon commented Mar 31, 2026

@MischaPanch It is better to use with agent the same LSP Server as in IDE — shared configs and so on

@MischaPanch
Copy link
Copy Markdown
Contributor

Ok, that makes sense. Pls adjust the PR to run basedpyright with uvx like I have recently done for ty, so it can be installed on the fly. Serena's users are essentially all uv users, and this way we can prevent having basedpyright as dependency. It's a fairly large package and offers no benefit to most users

@opcode81
Copy link
Copy Markdown
Contributor

opcode81 commented Apr 2, 2026

It is better to use with agent the same LSP Server as in IDE — shared configs and so on

Why though? Which problem is being solved? Why does the configuration even matter, and what, effectively, is the difference when using basedpyright instead of pyright as the Python language server with Serena?

@opcode81 opcode81 force-pushed the main branch 4 times, most recently from fee8b1c to d165272 Compare April 6, 2026 21:08
@TyceHerrman
Copy link
Copy Markdown

@opcode81 it would help ensure agents are type checking the same way you are if you're using basedpyright.

Also why basedpyright vs pyright - it has new diagnostic rules pyright doesn't and reimplements some pylance features.

And why basedpyright vs other lsps - slower than others, but best conformance as of today (though other lsps are closing the gap: https://htmlpreview.github.io/?https://github.com/python/typing/blob/main/conformance/results/results.html).

As one data point, Zed editor has made basedpyright their default lsp and disabled pyright out of the box.

vagvaz added a commit to vagvaz/serena that referenced this pull request Apr 20, 2026
- New BasedPyrightServer using uvx-based launch (no bundled pip dependency)
- PYTHON_BASEDPYRIGHT enum value (experimental)
- Configurable: ls_path override, basedpyright_version override
- Wired up in get_ls_class() and get_source_fn_matcher()
- Key difference from PR oraios#1240: no basedpyright pip dependency, no uv.lock
  changes, no nodejs-wheel-binaries bloat (~60MB)
vagvaz added a commit to vagvaz/serena that referenced this pull request Apr 26, 2026
- New BasedPyrightServer using uvx-based launch (no bundled pip dependency)
- PYTHON_BASEDPYRIGHT enum value (experimental)
- Configurable: ls_path override, basedpyright_version override
- Wired up in get_ls_class() and get_source_fn_matcher()
- Key difference from PR oraios#1240: no basedpyright pip dependency, no uv.lock
  changes, no nodejs-wheel-binaries bloat (~60MB)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants