News for hackers. Stuff that matters.
Re:Astral by zamnos on Tuesday April 18, 2023 @09:03PM (#35622839)
Why doesn't ruff reading/writing from stdin/out, combined with passing the data in with python subprocess.run and os.pipe work here?

    cat bad.py | ruff check --fix --stdin-filename stdin.py - > good.py
Substituting bad.py and good.py for in-memory os.pipe objects for your data. This still involves spawning a subprocess, which can add up, but you're not having to read/write to disk at least.
Re:Astral by senko on Wednesday April 19, 2023 @02:54AM (#35625099)
It does work. The tradeoff is:

* run ruff command many times (with different input file each time) * write all the files to "disk" (tempfs actually so it doesn't involve disk access) and run ruff once

Currently with black I avoid that by importing it as a module once so I get the benefits of both (and is simple to boot).

In other comments here I've read that a person heavily involved in Python-Rust interop is also part of the team, so there's hope they'll expose ruff as a module too and magically whisk my dilemma away :-)