quaint-telephone-89068
10/26/2022, 4:13 AMlibs
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:
[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/pantsuser
10/26/2022, 4:13 AM