pythonpython-poetryisort

How to make python-isort consider my pypackage.toml configuration?


I'm using isort toll to sort import statements in python.

I configured everything in my pyproject.toml file which looks like:

[tool.isort]
profile = "black"
multi_line_output = 5
atomic = true
include_trailing_comma = true
lines_after_imports = 2
lines_between_types = 1
use_parentheses = true
src_paths = ["src/mypackage", "tests"]
filter_files = true
known_first_party = "mypackage"

Yet, when lauching isort ., it sorted my docs/config.py file, meaning it did not consider the src_paths option.

Question: how to make it consider the .toml file configuration?


Solution

  • Because that's not what src_paths is for:

    Add an explicitly defined source path (modules within src paths have their imports automatically categorized as first_party).

    You'll want skip instead to ignore given paths.