<#17327 isort with multiple config files does not ...
# github-notifications
q
#17327 isort with multiple config files does not work correctly Issue created by AbdealiJK Describe the bug I have a project like:
Copy code
libs
    lib1
        pyproject.toml
        lib1
            ... files in the lib
        lib1_test
            ... tests for the lib
    lib2
        ... similar to lib1
    ... more libs
And I am using pyproject.toml for the isort configs:
Copy code
[tool.isort]
profile = "pycharm"
skip_glob = ["venv*"]
line_length = 110
known_first_party = ["lib1", "lib1_test"]
combine_as_imports = true
force_grid_wrap = 0
include_trailing_comma = true
order_by_type = false
case_sensitive = true
And the pyproject.toml for every lib changes the
known_first_party = ["lib1", "lib1_test"]
to treat only the library as a first party import. When I run:
./pants fmt ::
- it was using the wrong first party imports On @happy-kitchen-89482 's suggestio - tried:
./pants fmt libs/lib1/::
And it seemed to work After a lot of digging, I realized that isort finds the config file based on the 1st file provided to it https://pycqa.github.io/isort/docs/configuration/config_files.html And order of files that pants is sending into isort is mosst likely the culprit here. Pants version: 2.13.0 OS: Windows 10 + Ubuntu 18.04 LTS Additional info Slack conversation: link Another issue related to isort I checked: #15069 The batch ID concept in this issue may have been a workaround here: #14941 pantsbuild/pants