Unable to find Pylance in the extension marketplace

@Ryan_Wong

@ravirahman I want to say that I support Cursor, but Cursor pyright doesn’t work as well as Pylance. Those import directives are completely ineffective. When can Cursor properly address this extension issue, and at least not have so many annoying exception prompts?

Thanks for the feedback. Do the prompts keep on appearing? We added them in to help with the migration.

Regarding the import directives, do they work if you put them in a pyproject.toml file under the [tool.pyright] section, or a pyrightconfig.json file?

@onticdani

Could you try changing the “Type Check Mode” to “off”?

Just wanted to come here to +1 this thread. recently updated cursor and pylance blew up and couldn’t get it back. spent a whole day on this and even reinstalled macos. Was not able to get pylance back and working. Cursor Python (based pyright fork from Anytype) was completely unusable for both work and personal python projects due to an insane quantity of false positive linter errors.

For turning Cursorpyright > Analysis: Type Checking Mode form basic > off fixed things, but this was a MASSIVE headache.

You should really allow Pylance or the cursorpyright needs to mature significantly.

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.

2 Likes

It’s not their choice, Microsoft doesn’t allow the use of pylance on any software that is not theirs. Try my workaround below or install basedpyright which is the most similar to pylance and it’s open source

1 Like

Thanks @onticdani

I want to try your solution in my WSL environment. My Cursor version on another Mac is forever stuck at 1.0.0 hhhhh.


Your official docs seem to imply that Pylance is supported, which is a bit misleading imo.

Yes, I think it should be stated in the documentation, as Pylance currently easily causes understanding issues.

@ravirahman

Thanks for catching the out-of-date docs; we’re working on updating it!

this is what seemed to work for me. my results of manual matching pylance<>basedpyright are these overrides

  "cursorpyright.analysis.typeCheckingMode": "off",
  "cursorpyright.analysis.diagnosticSeverityOverrides": {
    "strictParameterNoneValue": true,
    "reportMissingModuleSource": "warning",
    "reportInvalidTypeForm": "warning",
    "reportMissingImports": "warning",
    "reportUndefinedVariable": "warning",
  }