Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode-isort ignores isort settings in pyproject.toml #272

Closed
garysassano opened this issue Apr 23, 2023 · 1 comment
Closed

vscode-isort ignores isort settings in pyproject.toml #272

garysassano opened this issue Apr 23, 2023 · 1 comment
Assignees
Labels
triage-needed Issue is not triaged.

Comments

@garysassano
Copy link

garysassano commented Apr 23, 2023

I like to have all my project's configuration inside the pyproject.toml instead of relying on the IDE, since other people may have that configured differently.

This is why I don't use this settings.json for my VS Code installation:

  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    },
  },
  "isort.args":["--profile", "black"],

but just:

  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    },
  },

Because in my pyproject.toml I have:

[tool.black]
line-length = 100

[tool.isort]
profile = "black"

The problem is that, when VS Code runs its internal source.organizeImports (which we know being just a masked isort) on save, it will completely ignore the settings specified in the pyrproject.toml.

On the other hand, when VS Code runs the black command for you on save, it will evaluate all settings you specified in your pyproject.toml, and so in my case it will set line-length = 100 correctly. The same thing doesn't apply to the isort that VS Code runs behind the scenes, which completely ignores any setting you may have in your pyrproject.toml.

@github-actions github-actions bot added the triage-needed Issue is not triaged. label Apr 23, 2023
@karthiknadig
Copy link
Member

Duplicate of #53

This is an issue with isort itself. it is not released yet by isort: PyCQA/isort#1992
see https://github.com/PyCQA/isort/blob/main/CHANGELOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

2 participants