- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 614
 
Open
Description
I have the following hook set up for use with pre-commit:
repos:
  - repo: https://github.com/PyCQA/isort
    rev: 6.0.1
    hooks:
      - id: isort
        args:
          - app
          - testsAnd the following lines at the bottom of my pyproject.toml file:
[tool.isort]
line_length = 100And this directory structure:
.
├── app
│   ├── __init__.py
│   └── ...
├── pyproject.toml
└── ...
When I run isort by hand it's seeing and honouring the line length setting in the pyproject.toml file, but when run inside the pre-commit hook it uses the default value.
I tried to explicitly set the config file in the pre-commit hook, but that gives me an error.
  - repo: https://github.com/PyCQA/isort
    rev: 6.0.1
    hooks:
      - id: isort
        args:
          - --settings-path=pyproject.toml
          - app
          - tests% pre-commit run isort
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /Users/matt/.cache/pre-commit/patch1748106524-66535.
isort....................................................................Failed
- hook id: isort
- files were modified by this hook
/Users/matt/.cache/pre-commit/repo4x7ic_j_/py_env-python3.12/lib/python3.12/site-packages/isort/main.py:1124: UserWarning: A custom settings file was specified: /Users/matt/devel/my_project/pyproject.toml but no configuration was found inside. This can happen when [settings] is used as the config header instead of [isort]. See: https://pycqa.github.io/isort/docs/configuration/config_files#custom-config-files for more information.
  config = Config(**config_dict)
Fixing /Users/matt/devel/my_project/app/models.py
[INFO] Restored changes from /Users/matt/.cache/pre-commit/patch1748106524-66535.
ShipraShalini
Metadata
Metadata
Assignees
Labels
No labels