Skip to content

Instantly share code, notes, and snippets.

@joeblackwaslike
Last active April 25, 2025 08:55
Show Gist options
  • Save joeblackwaslike/752b26ce92e3699084e1ecfc790f74b2 to your computer and use it in GitHub Desktop.
Save joeblackwaslike/752b26ce92e3699084e1ecfc790f74b2 to your computer and use it in GitHub Desktop.
How to use python with the Cursor IDE

How to use python with the Cursor AI IDE

We are going to edit cursors settings to point to the microsoft extensions marketplace.

  1. Remove all extensions and exit Cursor.
  2. Locate your Cursor project.json file depending on your platform and open it.
    • On MacOS: /Applications/Cursor.app/Contents/Resources/app/product.json
    • On Windows: C:\Users\<user_name>\AppData\Local\Programs\cursor\resources\app\product.json
    • On Linux: /usr/lib/code/product.json
  3. Locate the object value for key extensionsGallery in the json document.

Contents of extensionsGallery key in product.json for Cursor

{
    "galleryId": "cursor",
    "serviceUrl": "https://marketplace.cursorapi.com/_apis/public/gallery",
    "itemUrl": "https://marketplace.cursorapi.com/items",
    "resourceUrlTemplate": "https://marketplace.cursorapi.com/{publisher}/{name}/{version}/{path}",
    "controlUrl": "",
    "recommendationsUrl": "",
    "nlsBaseUrl": "",
    "publisherUrl": ""
}
  1. Edit it to look like this:
{
    "galleryId": "cursor",
    "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
    "itemUrl": "https://marketplace.visualstudio.com/items",
    "resourceUrlTemplate": "https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}",
    "controlUrl": "",
    "recommendationsUrl": "",
    "nlsBaseUrl": "",
    "publisherUrl": ""
}
  1. Reopen Cursor.app and install the following extensions:
    • ms-python.python
    • ms-python.vscode-pylance
    • ms-python.debugpy
  2. Make sure in your settings that python.languageServer is set to "Pylance"

Enjoy!

PS: you may need to goto your settings.json to remove any theme settings, because having a broken theme looks exactly like this same problem. In my case cursor had copied over my settings from vscode and they pointed to a theme that wasn't yet installed in cursor, removing and then setting the theme manually worked when I though for sure I had broken it again.

@Nivg
Copy link

Nivg commented Apr 6, 2025

Hi!

Thank you for this guide! I was wondering if there is any way to turn off the rewriting of product.json after each cursor update? It’s really annoying.

I just had the same question, each update I need to redo this process, the Cursor Python language support is broken!

@realdimas
Copy link

@PhenomenaPh, @Nivg – product.json is part of Cursor package.
You are hacking the internals of the app.
Each update override it – this is expected and no known workaround exist.
Understand that you generally want & need the updated product.json.
Its just that some keys in this file needs to be modified post-update to revive python extensions.

My approach: streamline the update of product.json file (see macOS script linked above that I use) and do upgrades manually (disable automatic upgrades) so that you can take care of "maintenance" tasks on your own time without disruption.

@Nivg
Copy link

Nivg commented Apr 6, 2025

@PhenomenaPh, @Nivg – product.json is part of Cursor package. You are hacking the internals of the app. Each update override it – this is expected and no known workaround exist. Understand that you generally want & need the updated product.json. Its just that some keys in this file needs to be modified post-update to revive python extensions.

My approach: streamline the update of product.json file (see macOS script linked above that I use) and do upgrades manually (disable automatic upgrades) so that you can take care of "maintenance" tasks on your own time without disruption.

It seems that in a devcontainer, where I set my extensions (and pylance is one of them), it's ignoring it and installing the cursoer pyright one all the time, do you have any idea about this issue?

Thanks!

@realdimas
Copy link

@Nivg locally, we fix this issue by patching product.json to shift away from the Cursor extension gallery and instead point to the Microsoft extension gallery.
We also bump the extension versions to the latest.
This allows us to install current and unmodified ms-python.python (and other) extensions via locally downloaded .VSIX files that don't depend on anysphere.pyright.

None of these local fixes have any effect on remote environments.

In remote environments, Cursor (VS Code) has its own product.json file and a modified version of the ms-python.python extension which declares a dependency on Cursor's Pyright (ID: anysphere.pyright) extension.

I didn't bother automating the rewrite of the remote product.json file, nor investigating how the patched ms-python.python extension gets there.

Instead, I use this workaround once per remote environment:

  1. Download Python extensions from Microsoft extension gallery as .VSIX files (matching the remote operating system and architecture).
  2. Drag-and-drop the .VSIX files into the Extensions tab's remote section.
  3. Reload window.
  4. Uninstall the Cursor Pyright extension.

I like to keep "Auto Update" checkbox unchecked to upgrade manually via .VSIX files instead.


Below are the direct download links to the current versions of Python extensions for linux-x64 and linux-arm64 architectures:

@Nivg
Copy link

Nivg commented Apr 9, 2025

@Nivg locally, we fix this issue by patching product.json to shift away from the Cursor extension gallery and instead point to the Microsoft extension gallery. We also bump the extension versions to the latest. This allows us to install current and unmodified ms-python.python (and other) extensions via locally downloaded .VSIX files that don't depend on anysphere.pyright.

None of these local fixes have any effect on remote environments.

In remote environments, Cursor (VS Code) has its own product.json file and a modified version of the ms-python.python extension which declares a dependency on Cursor's Pyright (ID: anysphere.pyright) extension.

I didn't bother automating the rewrite of the remote product.json file, nor investigating how the patched ms-python.python extension gets there.

Instead, I use this workaround once per remote environment:

  1. Download Python extensions from Microsoft extension gallery as .VSIX files (matching the remote operating system and architecture).
  2. Drag-and-drop the .VSIX files into the Extensions tab's remote section.
  3. Reload window.
  4. Uninstall the Cursor Pyright extension.

I like to keep "Auto Update" checkbox unchecked to upgrade manually via .VSIX files instead.

Below are the direct download links to the current versions of Python extensions for linux-x64 and linux-arm64 architectures:

Wow, many thanks for the very detailed explanation!

I wonder if with the new Microsoft enforcement rollout for using their extensions only in the official vscode, those workarounds won’t work anymore as well…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment