-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Python lsp: Pyright isn't good #7296
Comments
Yeah, We are working on language plugins at the moment, so, in the not-so-distant future, someone can just add these servers as plugins, but I do think we should swap out our provided one for a bettter one. |
Indeed they did build a language server protocol for Ruff already |
AFAICT, |
See that python-dotenv is installed, along with pydantic in my env - (pip list) but I guess pyright is not checking for packages in the project-directory/.venv ??? |
You need this file.
|
There's an issue #8541 about resolving modules with Pyright. |
I see this problem last for months, but there's still no real solution? |
This should actually solve the problem - for some reason, during the migration of our documentation, we lost our Python docs that mentions this config file. I've quickly dumped the old Python docs contents into the As a side note, I want to say that we are going to be doing more for Python here shortly - we recognize just how important this language is, being one of the top most-used languages, and we want to improve for Python devs in Zed. |
I tried it, but no luck. I use poetry in my python project, does it matter? |
To add to the corpus of Pyright issues, in
Additionally, in
I have done no custom configuration. I believe these shouldn't be showing issues as they work as expected and are standard practices. |
@newtome8888 run {
"venvPath": "/Users/username/Library/Caches/pypoetry/virtualenvs",
"venv": "projectname-p0LYZhue-py3.11"
} |
Just to mention, there is a setting in poetry tells poetry to install the venv within the project: Which would stabilize where the |
Using pyright is literally painful. |
I am running into the same issue. it's hurting more than its helping. |
@geoqiao pyright can be configured in the [tool.pyright]
venv = ".venv"
venvPath = "." |
It still needs to be manually configured. |
So, will there be an option system or extensions soon? I'd like Pylance but I'm not sure if it can be an extension. I've tried MyPy, but cannot remember if it was good |
Pylance is just pyright with a few small added features. Here is a list of differences: microsoft/pylance-release#3838 (comment) Pyright can definitely handle TypedDict. If you give more context, I can tell you what the problem is. I agree that pyright is currently hard to set up with Zed. But with [tool.pyright]
venvPath = "."
venv = ".venv"
# typeCheckingMode = "off" # uncomment this if you don't want type checking in my
it works very well. |
Off-topic, but @vladimir-sama your example is simply user error: |
Does Zed support to config pyright to make it work with workspaces? |
yes, i am also having this issue :( |
Just simply open the project form the terminal with env activated!!! I faced the same issue when opening project directory directly in zed, pyright started to yell "missing libraries". Solution:
now it should work smoothly |
doesn't work. activated the environment with poetry and still get unresolved imports. |
Run any Jupyter kernel in Zed on any buffer (editor): <img width="1074" alt="image" src="https://github.com/zed-industries/zed/assets/836375/eac8ed69-d02b-4d46-b379-6186d8f59470"> ## TODO ### Lifecycle * [x] Launch kernels on demand * [x] Wait for kernel to be started * [x] Request Kernel info on start * [x] Show in progress indicator * [ ] Allow picking kernel (it defaults to first matching language name) * [ ] Menu for interrupting and shutting down the kernel * [ ] Drop running kernels once editor is dropped ### Media Outputs * [x] Render text and tracebacks with ANSI color handling * [x] Render markdown as text * [x] Render PNG and JPEG images using an explicit height based on line-height * ~~Render SVG~~ -- not happening for this PR due to lack of text in SVG support * [ ] Process `update_display_data` message and related `display_id` * [x] Process `page` data from payloads as outputs * [ ] Render markdown as, well, rendered markdown -- Note: unsure if we can get line heights here ### Document * [x] Select code and run * [x] Run current line * [x] Clear previous overlapping runs * [ ] Support running markdown code blocks * [ ] Action to export session as notebook or output files * [ ] Action to clear all outputs * [ ] Delete outputs when lines are deleted ## Other missing features The following is a list of missing functionality or expectations that are out of scope for this PR. ### Python Environments Detecting python environments should probably be done in a separate PR in tandem with how they're used with LSP. Users likely want to pick an environment for their project, whether a virtualenv, conda env, pyenv, poetry backed virtualenv, or the system. Related issues: * #7646 * #7808 * #7296 ### LSP Integration * Submit `complete_request` messages for completions to interleave interactive variables with LSP * LSP for IPython semantics (`%%timeit`, `!ls`, `get_ipython`, etc.) ## Future release notes - Run code in any editor, whether it's a script or a markdown document Release Notes: - N/A
Run any Jupyter kernel in Zed on any buffer (editor): <img width="1074" alt="image" src="https://github.com/zed-industries/zed/assets/836375/eac8ed69-d02b-4d46-b379-6186d8f59470"> ## TODO ### Lifecycle * [x] Launch kernels on demand * [x] Wait for kernel to be started * [x] Request Kernel info on start * [x] Show in progress indicator * [ ] Allow picking kernel (it defaults to first matching language name) * [ ] Menu for interrupting and shutting down the kernel * [ ] Drop running kernels once editor is dropped ### Media Outputs * [x] Render text and tracebacks with ANSI color handling * [x] Render markdown as text * [x] Render PNG and JPEG images using an explicit height based on line-height * ~~Render SVG~~ -- not happening for this PR due to lack of text in SVG support * [ ] Process `update_display_data` message and related `display_id` * [x] Process `page` data from payloads as outputs * [ ] Render markdown as, well, rendered markdown -- Note: unsure if we can get line heights here ### Document * [x] Select code and run * [x] Run current line * [x] Clear previous overlapping runs * [ ] Support running markdown code blocks * [ ] Action to export session as notebook or output files * [ ] Action to clear all outputs * [ ] Delete outputs when lines are deleted ## Other missing features The following is a list of missing functionality or expectations that are out of scope for this PR. ### Python Environments Detecting python environments should probably be done in a separate PR in tandem with how they're used with LSP. Users likely want to pick an environment for their project, whether a virtualenv, conda env, pyenv, poetry backed virtualenv, or the system. Related issues: * zed-industries#7646 * zed-industries#7808 * zed-industries#7296 ### LSP Integration * Submit `complete_request` messages for completions to interleave interactive variables with LSP * LSP for IPython semantics (`%%timeit`, `!ls`, `get_ipython`, etc.) ## Future release notes - Run code in any editor, whether it's a script or a markdown document Release Notes: - N/A
This is a problem with pyright config, which has nothing to do with whether to activate the python virtual environment. We need a better way to make pyright work without generating pyryghtconfig.json every time opening a new project. |
it is not solve problem tbh |
i'm using https://github.com/DetachHead/basedpyright in vscode and it's been great so far at replacing normal pyright or pylance. could be worth a shot. |
@JosephTLyons when will this be resolved? The python devs are suffering, in fact Zed is unusable until this is resolved. Seeing unresolved imports is a pain. Thanks! |
I made a PR to allow for pyright settings, which could help with this. |
Is switched to https://github.com/DetachHead/basedpyright a bit a go in VSCode and it's been great. It should be a drop in replacement for pyright. ™️ Maybe make it so people can can choose between the two? One thing that is great about basedpyright is it is published as a pypi package so you can set the version you want inside of your python project. https://docs.basedpyright.com/#/?id=published-as-a-pypi-package-no-nodejs-required |
Hi, i have done one, but i cant test on linux(maybe a bug or skill issue), if you wanna test: |
@m1guer How to use? I select the directory on "Install Dev Extension" and nothing happens. |
i fixed some bugs, maybe works now.
|
@m1guer Just tried and does not work even with the setting. The extension does not appear in the Extension list. |
can open your logs? |
Here you go
|
try delete the grammar folder in the extension dir and install with pip install badedpyright |
@m1guer Works like a charm. |
:) |
Check for existing issues
Describe the feature
it should be pylsp. The pyright has issues about recognize libraries installed
If applicable, add mockups / screenshots to help present your vision of the feature
No response
The text was updated successfully, but these errors were encountered: