-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
pyright does weird stuff #15644
Comments
Hey @timptner, do you have any projects you could share that show the issue? I'm not able to reproduce this on my end - here's a project where print is being recognized by pyright: We've had some issues where restarting Zed, after creating a |
I noticed that each time I restart Zed it always checks for pyright updates and everytime downloads pyright. Don't know if this is expected behaviour. |
Just checked with my second workstation (debian) and there I don't get the pyright errors |
I've encountered the same problem:
There will be a warning with As @timptner said, this can be resolved by adding the following to pyproject.toml: [tool.pyright]
venvPath = "."
venv = ".venv" However this is a tweak that isn't needed when working in other editors. |
@JosephTLyons the same behaviour, venv's libraries pyright recognizing correctly, but pythons builtins not:
Previously it worked fluently, it seems that something became wrong after auto-update I using the same setting for venv and I tried recreate venv and restart zed. Disable of venv settings also not working. |
Just installed (.venv) aiven@MacBook-Pro test % pyright --version
pyright 1.1.375
(.venv) aiven@MacBook-Pro test % pyright main.py
0 errors, 0 warnings, 0 informations Seems like it's a local problem of the pyright version inside Zed. |
@timptner for me working this workaround:
After that need to restart Zed and it will automatically download latest pyright version |
This has solved it! |
This is still a problem on the Linux version of Zed. After running this command, the newly downloaded pyright has the same issues.
|
I encountered the same on zed preview, forced reinstall of pyright by deleting the existing pyright as suggested by @timptner . Working great since!! |
Check for existing issues
Related issues:
#13541 #13206 #12883 #11508 #10587 #7296 #8541 #7646 #5524
Describe the bug / provide steps to reproduce it
Fresh install of Zed and starting a python project with virtualenv pyright highlights all non-standard library imports as unresolvable. This is fine because pyright doesn't know anything about my virtualenv. But it also marks any python standard functions, e. g.
print()
orint()
.(1) Using
./pyproject.toml
it recognizes all custom imports but no longer standard library. Still does not know anything about standard python functions.(2) Using
./pyrightconfig.json
same results as with./pyproject.toml
.(3) Using global
~/.config/zed/settings.json
it does find all third-party libraries installed inside .venv and also finds standard libraries. But it still does not know about standard functions (print, int, dict, sorted, ...).I'm quite sure that some weeks ago I could solve all pyright errors by using
pyproject.toml
orpyrightconfig.json
. But in the meantime nothing seems to work anymore. Using combinations of those 3 options abovepyrightconfig.json
will overwritepyconfig.toml
andsettings.json
in their behaviour.Environment
Zed: v0.146.4 (Zed)
OS: macOS 13.6.7
Memory: 8 GiB
Architecture: x86_64
Python is installed via brew (python@3.12). PyRight is not installed via brew or as global pip package. (Brew stops one with a warning when trying
python3 -m pip install <package>
outside of an virtualenv.)If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log
The text was updated successfully, but these errors were encountered: