ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Expose Ruff's public API as a Python library

Open squiddy opened this issue 2 years ago • 4 comments
trafficstars

See https://github.com/charliermarsh/ruff/issues/659

  • [x] Accept options (need to check what a good way here is, either just a partial dictionary similar to WASM, or proper classes with type hints?)
  • [ ] Configure and document testing
  • [ ] Include in CI
  • [x] Build a wheel with binary and library
  • [x] Finalize what the API exactly is (https://github.com/charliermarsh/ruff/pull/1407#discussion_r1057768626)

squiddy avatar Dec 27 '22 16:12 squiddy

Most pieces are in place. Since maturin doesn't support binary+library in one package (at least I didn't find a way), I had to switch to the lower-level setuptools-rust. I need to do some more CI adjustments for that, so I'll be moving that into a separate PR.

squiddy avatar Dec 28 '22 11:12 squiddy

Sweet! I haven't reviewed yet, but @messense, do you know if Maturin can be used here to build a binary + library in one package?

charliermarsh avatar Dec 28 '22 12:12 charliermarsh

I haven't reviewed yet

For the record, it's also not in a state where I'm waiting for a review. I can still do some cleaning up, adding docs and function signatures to the library, adjust CI etc.

squiddy avatar Dec 28 '22 12:12 squiddy

do you know if Maturin can be used here to build a binary + library in one package?

Not yet, supporting both lib and bin will complicate bindings detection and our auditwheel Rust implementation, but it's been worked on slowly.

messense avatar Dec 28 '22 12:12 messense

I really think that this is too soon ... we have not even stabilized the Rust API ... I have been refactoring our Rust API a lot recently but it's still very much not ready to be used by any third party, since it's very much subject to change drastically.

not-my-profile avatar Jan 26 '23 06:01 not-my-profile

Yeah, I agree -- I was excited for this but I've realized that it's too soon. Let's close for now, since it's getting a bit stale anyway.

charliermarsh avatar Jan 26 '23 17:01 charliermarsh