tox-dev / pyproject-fmt

MIT License
167 stars 27 forks source link

API documentation section essentially empty #200

Closed adamtheturtle closed 4 months ago

adamtheturtle commented 4 months ago

Visit https://pyproject-fmt.readthedocs.io/en/latest/#module-pyproject_fmt, see:

Screenshot 2024-05-11 at 10 01 22

This section should either be removed or changed to explain an API.

gaborbernat commented 4 months ago

I think let's remove it, PR welcome.

gaborbernat commented 4 months ago

Done via https://github.com/tox-dev/pyproject-fmt/releases/tag/2.0.3

abravalheri commented 4 months ago

Does this mean that developers using the API should use https://github.com/tox-dev/pyproject-fmt-rust instead (I understand that one is currently undocumented but supposedly that is a WIP)?

gaborbernat commented 4 months ago

What's your use case?

abravalheri commented 4 months ago

For now, I would like to be able to run pyproject-fmt (with its default configurations) on a str variable from inside my Python code, without having to subprocess or create temporary files.

That is used in ini2toml to simply create a pyproject.toml file with the default formatting provided by pyproject-fmt.

Previously I was running

from pyproject_fmt import Config, format_pyproject
..
format_pyproject(Config(Path("pyproject.toml"), text))
gaborbernat commented 4 months ago

The rust package has no defaults. Today, your best chance would be to just do a sub process call. We could expose an endpoint for this functionality though. PR welcome 🤗

abravalheri commented 4 months ago

OK, I think in this case that might be a regression on https://github.com/tox-dev/pyproject-fmt/issues/3? (not really a regresion because there was a major version bump, but a removal of a feature previously implemented).

gaborbernat commented 4 months ago

We changed the interface, so the new API would also need to look differently.

abravalheri commented 4 months ago

Thanks @gaborbernat, I will give another go at reimplementing the feature with a new look.

gaborbernat commented 4 months ago

So if I understand this correctly you are not really interested in the fancy diff or check functionality. You just want to format the file after generating it with no output, Yes?

abravalheri commented 4 months ago

Yes, more or less.

I am more interested in formatting the string before saving the file (avoiding to touch the disk would be a big plus for me).

gaborbernat commented 4 months ago

Fixed via https://github.com/tox-dev/pyproject-fmt/releases/tag/2.1.0