-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Expose Ruff's public API as a Python library #1407
Conversation
src/lib_python.rs
Outdated
|
||
#[pyfunction] | ||
fn check(contents: &str) -> PyResult<Vec<Message>> { | ||
// TODO(rgerecke): Accept settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also accept an optional filename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On that topic, do we mirror the current API 1:1, i.e. should this also resolve settings by looking into the filesystem?
There was some discussion on the issue itself, but no clear direction yet (at least for me).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think we should. Similar to the Rust API (which doesn't accept settings... but should).
I think the rules are:
- If settings are provided, use those.
- Else, if filepath is provided, infer.
- Else, use defaults.
75db8af
to
7a91b3b
Compare
de5576a
to
6bd1f6b
Compare
maturin doesn't yet support packaging both a binary and a library into the same package. PyO3/maturin#368
6bd1f6b
to
79990b9
Compare
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. |
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? |
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. |
Not yet, supporting both lib and bin will complicate bindings detection and our auditwheel Rust implementation, but it's been worked on slowly. |
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. |
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. |
See #659