Experimental Python API for Ruff
NOTE: This is project is highly experimental and the API is likely to change. Pin your dependencies accordingly.
$ pip install ruff-api
import ruff_api
Format the contents of a file in memory:
code = ruff_api.format_string(filename, code)
Sort imports in memory:
code = ruff_api.isort_string(filename, code)
ruff-api is copyright Amethyst Reese, and licensed under the MIT license.