Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API documentation section essentially empty #200

Closed
adamtheturtle opened this issue May 11, 2024 · 12 comments
Closed

API documentation section essentially empty #200

adamtheturtle opened this issue May 11, 2024 · 12 comments

Comments

@adamtheturtle
Copy link
Contributor

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
Copy link
Member

I think let's remove it, PR welcome.

@gaborbernat
Copy link
Member

@abravalheri
Copy link
Contributor

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
Copy link
Member

What's your use case?

@abravalheri
Copy link
Contributor

abravalheri commented May 13, 2024

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
Copy link
Member

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
Copy link
Contributor

abravalheri commented May 13, 2024

OK, I think in this case that might be a regression on #3? (not really a regresion because there was a major version bump, but a removal of a feature previously implemented).

@gaborbernat
Copy link
Member

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

@abravalheri
Copy link
Contributor

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

@gaborbernat
Copy link
Member

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
Copy link
Contributor

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 gaborbernat reopened this May 14, 2024
@gaborbernat
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants