Python in Visual Studio Code simplifies refactoring

Microsoft has updated the Python and Jupyter extensions for its open source code editor, Visual Studio Code. With the April update, the refactoring of Python code with the Language Server Pylance should be easier. In addition to other innovations, the data science extension Data Wrangler has been released as a preview version for VS Code insiders.

A new code action is available for refactoring Python code with Pylance: Move symbol. According to the development team, this is one of the most requested features in the Pylance repository. It is therefore based on an existing feature from the JetBrains IDE PyCharm, the moving of top-level symbols.

In order to use the new function, it is necessary to select an icon in a Python file and then click on the lightbulb that appears. The icon can then be moved either to an existing file or to a new file. If the target is a new file, this will result in the creation of a Python file with the same name as the symbol. All applicable import references are automatically updated as the icon is moved.


Pylance can be used to move a symbol to a new or existing file.

Pylance can be used to move a symbol to a new or existing file.

Pylance can be used to move a symbol to a new or existing file.

(Image: Microsoft)

There is also something new for extension developers: the Python API of the Python extension is now considered finalized. It allows working with Python environments on a user’s computer. Extensions can also use them to access the selected environment path that the Python Extension uses to run scripts, or update it to a desired path.

Anyone participating in the Visual Studio Code Insider Program can install the Data Wrangler extension, which is available as a preview. It is intended for data scientists and data analysts using tabular data in Python. The extension can be called from any pandas dataframe output in a Jupyter notebook. Right-clicking to open a CSV or Parquet file and then selecting Open in Data Wrangler is also possible.

Data Wrangler allows data to be cleaned and explored and is designed to help quickly identify and fix errors, inconsistencies and missing data. Other features include data profiling, data quality checks, visualizing data distributions, and transforming data into another format. A blog entry describes further information on Data Wrangler.

The extensions for Python and Jupyter as well as the preview version of Data Wrangler are available for download in the Visual Studio Marketplace. All further information about the innovations for Python in VS Code can be found on Microsoft’s developer blog.


(May)

To home page

Related Posts

Hot News

Trending

usefull links

robis robis robis