Feature request: Build a published crate as a RustExtension (for use with `ctypes` or `cffi` directly)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu bằng cách đọc hack được trích dẫn trong _backend/rustfst_backend/build_meta.py và entry point setuptools_rust.setuptools_ext.rust_extensions. Xác định cách một RustExtension có thể build một dependency đã được publish và expose shared library của nó trên các platform được hỗ trợ, sau đó xác định tiêu chí hoàn thành xoay quanh một tùy chọn source_package hỗ trợ use case ctypes hoặc cffi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hopefully I haven't missed something and this isn't already possible (perhaps with some invocation of maturin that I didn't see in the documentation?)...
It would be nice to be able to create a Python package which contains no actual Rust code of its own but simply builds a publicly available crate (which exports a C interface) and calls into it with ctypes. This may be a bit of a niche use case? I am using it with https://crates.io/crates/rustfst-ffi/1.2.6 because the upstream mantainers, while they publish a Python package, don't publish it as a source distribution and so it can only be installed from PyPI on platforms for which a binary exists.
Now obviously you shouldn't do that. So, I've found a somewhat ugly hack, which is to simply create an empty library with the desired crate as a dependency, then copy the shared library for the dependency instead of the built library (which, obviously, exports none of its dependency's symbols). This is done by monkey-patching setuptools_rust.setuptools_ext.rust_extensions in an in-tree build backend: https://github.com/dhdaines/rustfst/blob/standalone_python/_backend/rustfst_backend/build_meta.py
Not being an expert in Rust I don't know if this works on all platforms or if there's a better way to do it. But I think it would be relatively easy to add this as an option to RustExtension, perhaps, source_package, which would do what the hack above does.
- Ngôn ngữ chính
- Python
- Star
- 680
- Fork
- 110
- Merge trung bình
- 3 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PyO3/setuptools-rust
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
PyO3/setuptools-rust#619 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
PyO3/setuptools-rust#610 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
PyO3/setuptools-rust#507 · 3 bình luận ·
-
How to use with dockerĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
PyO3/setuptools-rust#449 · 10 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
PyO3/setuptools-rust#344 · 7 bình luận ·
Tất cả issue của PyO3/setuptools-rust
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PedestrianDynamics/pyFDS-Evac#199 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
521xueweihan/HelloGitHub#3790 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sandialabs/atlas-ui-3#978 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: tests perceived difficulty: 2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Nitjsefnie-Harness-Commons/daedalus#1255 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hf-audiolm-qwen: `generate_until` hardcodes `.to("cuda")` and aborts on non-CUDA acceleratorsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
EleutherAI/lm-evaluation-harness#4256 ·
Maintainer thường phản hồi trong vòng 1 ngày