bwhmather / ssort

Tool for automatically sorting python statements within a module
MIT License
359 stars 10 forks source link

Add pyproject.toml / setup.py configuration #72

Open SerGeRybakov opened 2 years ago

SerGeRybakov commented 2 years ago

Hi! Though I use ssort in pre-commit and CI I think it will be nice to have a possibility to set up ssort configuration in default pyproject.toml / setup.py files. There one can explicitly exclude some folders or files from ssorting, set the ordering and all other other possible cli-configs. Is it possible?

bwhmather commented 2 years ago

Hi @SerGeRybakov - Sorry for slow response. Glad to hear you are using ssort. Ordering isn't really configurable in any way at the moment, and I'm hesitant to change that. Excluding folders and files based on pyproject.toml would definitely be possible though, and something I would be glad to have in the project. At the moment we exclude based on .gitignore. I think you would probably need to extend this function to also find, parse and cache pyproject.toml files: https://github.com/bwhmather/ssort/blob/65c4b0a1f2e9e93e65855967f9a438046b24d9e1/src/ssort/_files.py#L35-L48.

A related issue is https://github.com/bwhmather/ssort/issues/62. It might make sense to also have pyproject.toml change the default behaviour when running ssort in a folder without arguments.

I'm a bit snowed under at the moment, so won't be able to implement any time soon. I'm going to mark this as good first issue. If you want to take a stab at it, I will happily review.

cgahr commented 1 year ago

I'm implementing this

cgahr commented 1 year ago

Closed by #84