haystack icon indicating copy to clipboard operation
haystack copied to clipboard

Sort imports with isort

Open mjspeck opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Imports are unstandardized, adding friction to outside developers contributing.

Describe the solution you'd like Add in support for isort including a pre-commit hook, and configuration in pyproject.toml. This will not only sort imports, but ensure that all future imports are sorted according to the same specification.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

### Tasks
- [ ] add isort configuration and dev dependency to pyproject.toml
- [ ] add isort to pre-commit-config.yaml
- [ ] add isort check to ci pipeline
- [ ] sort imports once all configuration is done

mjspeck avatar Sep 29 '23 18:09 mjspeck

We reverted PR #5933 with #5980 as isort and black were conflicting. Reopening.

silvanocerza avatar Oct 05 '23 16:10 silvanocerza

Btw, there black / isort compatibility here: https://pycqa.github.io/isort/docs/configuration/black_compatibility.html

Anyway, I enabled checking for the right sorting using ruff here: https://github.com/deepset-ai/haystack/pull/7207

wochinge avatar Feb 29 '24 13:02 wochinge