When isort is installed as part of a pre-commit hook, it needs to be installed with setuptools' "extras" for pyproject.
This is installed with pip install isort[pyproject] rather than the default install of pip install isort. When installing from a local repo, the command is pip install .[pyproject]
Is it possible to specify that in a .pre-commit-hooks.yaml?
Ref https://github.com/timothycrosley/isort/issues/1225
Thank you!
I believe you're looking for additional_dependencies
specifically:
- id: isort
additional_dependencies: ['.[pyproject]']
or whatever extra you want
Ah, this used to bite me all the time! This solution (.[extra]) is a lot nicer than anything I ever came up with. I wonder if it's worth noting this trick in the docs somewhere? I guess it's low priority because isort no longer has these set up as extras, but still, this is a really nice solution and I feel like it should be more visible.
Most helpful comment
specifically:
or whatever extra you want