Visual Studio Code

The Studio Map SDK supports notebooks within Visual Studio Code.

Studio Map SDK in Visual Studio Code.Studio Map SDK in Visual Studio Code.

Studio Map SDK in Visual Studio Code.

Installation

To use the Map SDK within Visual Studio Code, you need to have a Python environment on your computer with unfolded.map-sdk version 0.6.1 or higher installed:

$ pip install unfolded.map-sdk

When you attempt to run Python code, Visual Studio Code will prompt you to choose among the Python environments you have on your computer:

Choosing a Python environment in VS Code.Choosing a Python environment in VS Code.

Choosing a Python environment in VS Code.

Using with a Jupyter Notebook

Visual Studio Code allows you to open Jupyter Notebooks (with extension .ipynb). To the left side of a cell should be a "play" button that allows you to run the contents of the cell (this action appears to be mapped to Shift + Enter by default).

Upon running a cell, Visual Studio Code will run the cell's contents in a Jupyter session and show the output below the cell. Note the button at the top left of the below screenshot.

Running a cell in Visual Studio Code Notebooks.Running a cell in Visual Studio Code Notebooks.

Running a cell in Visual Studio Code Notebooks.

Using with a Python Script

Visual Studio Code also allows you to run Python code from a script, outside of the confines of a Notebook.

If you have a Python script open, you should be able to open the command prompt and then run "Python: Run Selection/Line in Python Terminal" (this appears to be mapped to Shift + Enter by default). This will open an instance of Python on the right side of your screen. Because this Python instance is backed by Jupyter under the hood, the Map SDK will work normally.

Map SDK in Visual Studio Code.Map SDK in Visual Studio Code.

Map SDK in Visual Studio Code.


Sign In