Unable to find Pylance in the extension marketplace

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:

  1. Bring back Microsoft’s extensions
  2. 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 basedpyright as it has most of pylance functionality, it’s open source and doesn’t collect your data.

First, you need to bring back the VSCode marketplace

  1. Go to the settings @ravirahman said: Hit F1 → Open VSCode Settings → Features → Extensions

  2. Then find Gallery: Item Url and Gallery: 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

Like this:

  1. Then restart cursor, all the previous extensions should be now available in the marketplace.

  2. Install pylance

Now you need to dissable Microsoft’s checks (thanks to this comment in GitHub):

  1. Find your extensions path:

    I use an ubuntu devcontainer so my extensions path is ~/.cursor-server/extensions/, for Windows and Mac you should look it up.

  2. Find the pylance dist files (cursor installs 2024.8.1 version of pylance):
    .../extensions/ms-python.vscode-pylance-2024.8.1/dist

  3. Make a backup copy of the extension.bundle.jsextension.bundle.js.bak

  4. Open the original extension.bundle.js file, 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}
    
  5. 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.