Is it possible to call ruff format within Python (not using subprocess)? #12351
Replies: 1 comment
-
There's currently no existing way to call Ruff format from within Python other than using:
See #659 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Use case is that I'm using jinja to codegen some python files. Jinja has whitespace control, but it's tedious, so I'd like to call ruff on the string (containing python) to format the code.
I'm able to call
subprocess.run(['ruff', 'format', ...])
after the files are completed.However, I'd also like to write tests on my jinja templates and it would be really nice to be able to call ruff directly on the strings in my tests so that I don't need to spend time fiddling with whitespace differences.
Beta Was this translation helpful? Give feedback.
All reactions