tox-dev / pyproject-fmt

MIT License
167 stars 27 forks source link

Reintroduce public API (previously removed in 2.0) #214

Closed abravalheri closed 4 months ago

abravalheri commented 4 months ago

This PR re-introduces an public Python API. The API was changed to be modelled after pyproject-fmt-rust, but it adds conveniences such as default configuration values + the ability for reading configuration from the file being formatted.

The motivation and use case are described in #3 and https://github.com/tox-dev/pyproject-fmt/issues/200#issuecomment-2108530014.

In terms of implementation, some functionalities from the cli module were moved/refactored into the new module.

Please take this as just an example on how things could work (and I am sure that there is a bunch of bike-shedding to be discussed). Please also feel free to close this PR if the approach is too far from what is acceptable, and also please feel free to steal parts of the PR to create something different.

abravalheri commented 4 months ago

No problems, thank you for the review.