Vscode-python: Sorting pylint(wrong-import-order)

Created on 26 Sep 2020  路  2Comments  路  Source: microsoft/vscode-python

Environment data

  • VS Code version:

Version: 1.49.2
Commit: e5e9e69aed6e1984f7499b7af85b3d05f9a6883a
Date: 2020-09-24T16:23:52.277Z (1 day ago)
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0

  • Extension version (available under the Extensions sidebar): XXX
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): poetry
  • Value of the python.languageServer setting: Tried both, including Pylance

Expected behaviour

sort imports by os > 3rd party > package

Actual behaviour

not sorting right

Steps to reproduce:

extension v2020.8.109390

sorts likes this:

from typing import Any

from boto3.dynamodb.conditions import Key
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

from app import database, exceptions, models
from app.core.logger import get_logger

extension v2020.8.109390

sorts likes this:

from typing import Any, Dict, Generic, List, Type, TypeVar, Union

from app import database, exceptions, models
from app.core.logger import get_logger
from boto3.dynamodb.conditions import Key
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

Is there some configuration im missing here?

type-bug

Most helpful comment

following up:

seems adding this to the pyproject.toml helped it get imports right.

[tool.isort]
sections = ['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER']

Is this an isort v 5.5.23 issue?

All 2 comments

following up:

seems adding this to the pyproject.toml helped it get imports right.

[tool.isort]
sections = ['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER']

Is this an isort v 5.5.23 issue?

Sorting is done via isort. So you will have to configure isort for this. The latest extension ships with isort==5.5.3. Previous versions shipped with isort==5.3.2

Was this page helpful?
0 / 5 - 0 ratings