Python in Visual Studio Code – April 2023 Release

Courtney Webster

We’re excited to announce that the April 2023 release of the Python and Jupyter extensions for Visual Studio Code are now available!

This release includes the following announcements:

  • Data Wrangler available for Visual Studio Code Insiders
  • Move symbol refactoring
  • Create Environment button embedded in dependency files
  • Environments API for extension authors
  • Kernel Picker Improvements for Python Environments

If you’re interested, you can check the full list of improvements in our changelogs for the Python, Jupyter and Pylance extensions.

Data Wrangler available for Visual Studio Code Insiders

Data Wrangler, a revolutionary tool for data scientists and analysts who work with tabular data in Python, is now available on VS Code Insiders. Data Wrangler is an extension for VS Code Insiders and can be launched from any Pandas dataframe output in a Jupyter notebook, or by right-clicking any CSV or Parquet file in VS Code Insiders and selecting Open in Data Wrangler.

With Data Wrangler, you can seamlessly clean and explore your data in VS Code Insiders. It offers a variety of features that will help you quickly identify and fix errors, inconsistencies, and missing data. You can perform data profiling and data quality checks, visualize data distributions, and easily transform data into the format you need. Plus, Data Wrangler comes with a library of built-in transformations and visualizations, so you can focus on your data, not the code. As you make changes, the tool generates code using open-source Python libraries for the data transformation operations you perform. This means you can write better data preparation programs faster and with fewer errors. The code also keeps Data Wrangler transparent and helps you verify the correctness of the operation as you go.

View data summary and fill missing values with Data Wrangler

To learn more about Data Wrangler, read our full Data Wrangler release blog.

Move symbol refactoring

You can now more conveniently refactor your Python code with Pylance, thanks to the new Move symbol Code Action! We’re excited about this enhancement as it’s one of the most requested features in the Pylance repository pylance-release/discussion#2620.

To try it out, select a symbol in a Python file and click on the light bulb that is presented (kb(editor.action.quickFix)). You can either move the symbol to an existing file or to a new file. If the location is a new file, a Python file is created with the same name as your symbol. All the applicable import references are automatically updated with the symbol move.

Using the Move Symbol To code action with Pylance

Create Environment embedded in dependency files

The Python: Create Environment command is now embedded in dependency files. When you open a requirements.txt or a pyproject.toml file with a [build-system] table, there’s a new Create Environment… button in the editor that runs the Python: Create Environment command, allowing you to create a new virtual environment and install the listed dependencies.

A `pyproject.toml` file open with dependencies listed, and a **Create Environment** button displayed on the bottom right corner for the editor

Environments API for extension authors

The Python extension’s API to work with Python environments available in the user’s machine has now been finalized. Extensions can also use it to access the selected environment path that’s used by the Python extension to run scripts, or update it to their preferred one.

Example usages can be found in the Python Environment APIs wiki page. We are also planning to release an npm types package in the future so it’s easier to keep track of any changes in the Python API.

Kernel Picker Improvements for Python Environments

The kernel picker now lists Conda environments without Python installed in them.

For instance, if a new Conda environment is created using a CLI such as conda create -n envML, this new environment will be displayed in the list of Python Environments under the Conda Env Without Python section.

Upon selecting such an environment, the Python runtime and necessary dependencies will be automatically installed into the selected environment.

Jupyter feature showing Conda environments without Python installed in them

Other Changes and Enhancements

We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python and Jupyter Notebooks in Visual Studio Code. Some notable changes include:

  • Autocomplete keys for get method (pylance-release#3994)
  • Remove support for python.linting.ignorePatterns (pylance-release#4100)
  • IntelliSense improvements when using Pylance for packages such as lightgbm, networkx, vispy, cv2, matplotlib, and sklearn, thanks to new and/or updated type stubs

Try out these new improvements by downloading the Python extension and the Jupyter extension from the Marketplace, or install them directly from the extensions view in Visual Studio Code (Ctrl + Shift + X or ⌘ + ⇧ + X). You can learn more about Python support in Visual Studio Code in the documentation. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.


Discussion is closed.

Feedback usabilla icon