PyCQA / isort

A Python utility / library to sort imports.
https://pycqa.github.io/isort/
MIT License
6.45k stars 574 forks source link

Isort does not honor skip directories #2273

Open alex-morgun opened 2 months ago

alex-morgun commented 2 months ago

Problem: I have a python project, trying to skip directories, somehow it gos to .cache and ignores all my efforts to skip it.

I guess my .venv may have a link to .cache, but why don't isort check directory path?

isort . --skip=".cache" --interactive

--- /home/user/.cache/serverless-python-requirements/649a0cce5c24ce3a831267ed1824fdb9b81342d2fe79bfbb8e22ff4b581f0dcc_x86_64_slspyc/openai/cli/_api/models.py:before  20

isort . --skip-glob="**/.cache/*" --interactive
--- /home/user/.cache/serverless-python-requirements/649a0cce5c24ce3a831267ed1824fdb9b81342d2fe79bfbb8e22ff4b581f0dcc_x86_64_slspyc/openai/cli/_api/models.py:before  2024-06-30 02:59:45.979922

isort --settings-path ./pyproject.toml --interactive .

--- /home/user/.cache/serverless-python-requirements/649a0cce5c24ce3a831267ed1824fdb9b81342d2fe79bfbb8e22ff4b581f0dcc_x86_64_slspyc/openai/cli/_api/models.py:before  2024-06-30 02:59:45.979922
[tool.isort]
profile = "black"
skip = [".venv", "node_modules"]
skip_glob = ["*/.cache/*", "*/.venv/*", "*/node_modules/*"]

Solution:

isort package_path/