iterative / dvclive

📈 Log and track ML metrics, parameters, models with Git and/or DVC
https://dvc.org/doc/dvclive
Apache License 2.0
161 stars 35 forks source link

add toml formatter for pyproject.toml #775

Closed AlexandreKempf closed 7 months ago

AlexandreKempf commented 7 months ago
AlexandreKempf commented 7 months ago

Ah! I understand now why it was not using a formatter already. We cannot use a pre-commit formatter on cookie-cutter projects because the TOML/YAML files are not valid TOML/YAML before the project is initiated. We can keep it for this repo, or we can remove it, as you prefer ;)

dberenbaum commented 7 months ago

@AlexandreKempf Good point, but unless I'm missing something, I still think you could add the changes back to that cookiecutter manually so that:

  1. The formatting will be fixed in the template
  2. The generated projects will inherit the pre-commit formatter
AlexandreKempf commented 7 months ago

@dberenbaum I'm wondering if I get you right. Or maybe I wasn't clear enough in my comment. If I add the formatters in the py-template's pre-commit, it will try to pre-commit the py-template project. Or there are plenty of toml files that are not valid for the formatter (stuff like {%- if cookiecutter.docs != "False" %}), and at the end, the project refuses to commit my changes.

Is there something I'm missing? What did you have in mind exactly?

dberenbaum commented 7 months ago

It might be my misunderstanding since I haven't tried it. Are you putting it inside or outside the cookiecutter? Does it run the pre-commit inside the cookiecutter?

AlexandreKempf commented 7 months ago

Oh my mistake! I putted it outside :( Thanks for the explanation. I'm doing the PR on py-template :)