VSCode extension to sort and refactor python imports using reorder-python-imports

reorder-python-imports

VSCode extension to sort and refactor python imports using reorder-python-imports.

Unlike other import organizers, reorder-python-imports focuses on reducing the frequency of merge conflicts, using static analysis to avoid the need for an active venv, and providing better better compatibility with pre-commit and black.

To learn more, visit the original tool’s homepage.

Features

Refactoring the imports is provided as a code action, which can be invoked by right clicking on the code or the lightbulb icon and selecting Reorder Imports, or selecting Python Refactor: Reorder Imports from the command palette.

context-menu-example

Settings

Below is an example of a settings.json file with settings relevant to vscode-reorder-python-imports.

{
"reorder-python-imports.args": [
"--application-directories=.:src",
"--add-import 'from __future__ import absolute_import'",
"--add-import 'from __future__ import division'",

 

 

 

To finish reading, please visit source site