如何让 python-isort 考虑我的 pypackage.toml 配置?

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

我正在使用 isort toll 对 python 中的导入语句进行排序。

我在 pyproject.toml 文件中配置了所有内容,如下所示:

[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"

然而,当启动 isort . 时,它对我的​​ docs/config.py 文件进行了排序,这意味着它没有考虑 src_paths 选项。

问题:如何让它考虑.toml文件配置?

因为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).

您需要 skip 而不是忽略给定路径。