-
Notifications
You must be signed in to change notification settings - Fork 234
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
How does Python LSP integration work? #783
Comments
Hey @cbarrete, I have an understanding of how this works internally for the Pyre type checker, but let me see if I understand your question correctly. Are you looking to build the The For Pyre, we use the resulting sourcedb to understand what file an import in a Python file actually points to, and to make sure something like a .pyi file generated from specific c(++) rules exist for us to use. |
Hey, sorry for the delay and thanks for your reply! What I want is to setup a good Python dev experience, including:
There are various tools and language servers that can do this, but most of them require a "proper" Python setup, which typically means a Ruff can handle some parts of this without much configuration, but e.g. type checking ore more advanced linting require project metadata. My understanding is that the prelude exposes this via the I'm fine with using Pyre (it's not ideal to be locked into a single type checker, but oh well), but the docs for how to integrate it into an editor are missing. The configuration docs mention some JSON config, but the schema doesn't match that of a Is there some documentation somewhere about how to get Pyre (or ideally any language server) to use a sourcedb? |
There are examples for using LSP (pyright) in here: https://github.com/cormacrelf/elk Specifically https://github.com/cormacrelf/elk/blob/master/example/venv.sh. Just launch your LSP with this as the wrapper. You can probably use VSCode's pylance this way to get a full dev experience. None of this requires using elk, actually. You can drop this in any old buck project. (I think |
My understanding is that Python LSP integration is supposed to be built using the
source-db
subtargets (and accompanying BXL scripts in the prelude), but I cannot find any mentions of "source db" in language server docs.I'm very unfamiliar with the Python ecosystem, could somebody give me some pointers for where to start looking?
My understanding is that in the Bazel world, this is achieved by making venvs that contain both third-party and local dependencies. Is it similar in the Buck2 world?
I've looked at the git log for
prelude/python/sourcedb/ide.bxl
, but it's not quite enough context I believe.The text was updated successfully, but these errors were encountered: