-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Python interface to Black #1449
Comments
Because https://github.com/psf/black#note-this-is-a-beta-product |
I just mean that it's not maintainable for me to copy and paste bits of the internal code. |
See also #779. |
That said, we're trying hard to not break people. The But I think adding a documented abstracted public API to give us more wiggle room before we go stable is probably a good idea too. |
So, at the moment, this is my code to run black (as part of a pre-commit hook). Current master has a However, notice that I've changed the single file logic to check the include regex. Current black code assumes that any individual files should skip the tests, as they are explicitly given on the command line. However, here we are passing a list of files that have changed in Git, so I still need these checks to happen.
|
Duplicate of #779 |
That was mentioned in a previous comment, but that ticket asks for a format_str() function, rather than something that will format files. So, I think this is really an extension of that issue, rather than a duplicate. |
@Dreamsorcerer, I was the one who marked this as a duplicate. Admittedly, your issue does bring an overarching request to the table that wasn't present in the original issue. I think where I got sidetracked was with the titles. to me Although, I should add a comment updating that issue for 2020. But if you still think this issue should stay open, well, I'm open to opening it :P |
As long as this use case is still being considered/tracked, it's totally fine. |
For v20, plus now reading the config file, our code for running Black now looks like this:
Minor improvements since v19, but could still do a lot better. |
It would be nice to have a direct Python interface to black that is easy to use and documented.
e.g.
Trying to figure out how to do this from the source code of the main() function is not very easy, and appears that the code is changing, so not very maintainable either.
The text was updated successfully, but these errors were encountered: