I had that already, but the issue is that now I don’t get any warning errors if I, for instance, didn’t import a library. I tried installing django stubs and such, both with pyright and mypy but it’s just a mess and couldn’t get them to work properly.
With pylance everything works out of the box, it can infer most django types (not all though, but at least I can have the most critical checks in place).
I guess pylance is no longer available in the Extensions marketplace since Cursor switched to the OpenVSX marketplace.
But there’s a workaround to use pylance in Cursor:
There are 2 steps to this:
- Bring back Microsoft’s extensions
- Even with pylance installed, it won’t work due to Microsoft’s checks on the IDE you’re using inside the pylance extension. In other words, it will check if you’re using VSCode, and if not, it won’t activate the extension.
Note that this was a hassle to implement and, though it works, I agree with the peeps that say we should start using
basedpyrightas it has most ofpylancefunctionality, it’s open source and doesn’t collect your data.
First, you need to bring back the VSCode marketplace
-
Go to the settings @ravirahman said: Hit
F1→ Open VSCode Settings → Features → Extensions -
Then find
Gallery: Item UrlandGallery: Service Url:- For “Gallery: Item Url” input this Url:
https://marketplace.visualstudio.com/items - For “Gallery: Service Url” input this Url:
https://marketplace.visualstudio.com/_apis/public/gallery
- For “Gallery: Item Url” input this Url:
Like this:
-
Then restart cursor, all the previous extensions should be now available in the marketplace.
-
Install pylance
Now you need to dissable Microsoft’s checks (thanks to this comment in GitHub):
-
Find your
extensionspath:I use an ubuntu devcontainer so my
extensionspath is~/.cursor-server/extensions/, for Windows and Mac you should look it up. -
Find the pylance dist files (cursor installs
2024.8.1version of pylance):
.../extensions/ms-python.vscode-pylance-2024.8.1/dist -
Make a backup copy of the
extension.bundle.js→extension.bundle.js.bak -
Open the original
extension.bundle.jsfile, find and remove this string:return(0x0,_0x3cf4c5[_0x41b32f(0x1cb)])(_0x1802de['licenseErrorText']),{'client':_0x114703,'start':()=>{const _0xdc463e=_0x41b32f;return _0x5f5976[_0xdc463e(0x472)](_0x15fc6b[_0xdc463e(0x596)][_0xdc463e(0x4e4)]),Promise['resolve']();},'stop':()=>Promise[_0x41b32f(0x147)](),'disposables':_0xf1f7d3} -
Restart Cursor and pylance should be working fine.
Again, pylance works fine with this, but I will be using basedpyright from now on to support the open source alternative to pylance.
