pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.15k stars 131 forks source link

pre-commit hook for `pyroject.toml` #507

Open chrisjsewell opened 2 years ago

chrisjsewell commented 2 years ago

Heya sorry this is maybe outside the scope of the package, but I wasn't sure where else to ask.

With setuptools, I have been using https://github.com/asottile/setup-cfg-fmt as a pre-commit hook to keep my setup.cfg nicely formatted and up-to-date.

From a quick google, I haven't seen anything similar when moving to flit, so wanted to check here before I created my own one?

I think you could have an even nicer one that setup-cfg-fmt, because you could use something like https://github.com/sdispater/tomlkit, to e.g. preserve comments.

gaborbernat commented 2 years ago

IMHO this is definitely out of scope for this project. I know @RonnyPfannschmidt has also been looking for something like that but I haven't seen any such pyproject.toml formatter out there yet. It's a great side-project idea if you have the free time for it.

RonnyPfannschmidt commented 2 years ago

There is some preliminary work on this for pep 621 converter for setuptools

chrisjsewell commented 2 years ago

thanks for letting me know @RonnyPfannschmidt, do you have a link to a particular repo or anything?

RonnyPfannschmidt commented 2 years ago

https://github.com/abravalheri/ini2toml is the starting point, my understandign is that they plan to eventually complete it by adding a tomlkit based re-formatter later on