Feature request: Build a published crate as a RustExtension (for use with `ctypes` or `cffi` directly)
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- build-system
調査の方向性
まず、引用されている _backend/rustfst_backend/build_meta.py のハックと setuptools_rust.setuptools_ext.rust_extensions エントリポイントを読みます。RustExtension が公開済みの依存関係をビルドし、サポート対象のプラットフォーム全体でその共有ライブラリを公開する方法を確認し、そのうえで ctypes または cffi のユースケースをサポートする source_package オプションを基準に完了条件を定義します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 681
- フォーク
- 110
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PyO3/setuptools-rust のほかの issue
-
Support PEP 831オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
PyO3/setuptools-rust#621 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
PyO3/setuptools-rust#619 ·
-
Builds run `cargo metadata` for all platforms対応中かも @WhyNotHugo が 79 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
PyO3/setuptools-rust#610 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
PyO3/setuptools-rust#507 · コメント 3 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
PyO3/setuptools-rust#449 · コメント 10 件 ·
PyO3/setuptools-rust の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
gradio-app/gradio#13964 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 93/100
BSData/horus-heresy-3rd-edition#3232 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jbacalso24/mimry#123 ·
メンテナーはふだん 1 日以内に返信
-
p:3-mid pydanty:bug pydanty:is-working
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
pydantic/pydantic-ai#10153 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
good first issue priority: medium size: S testing
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
cubrid-lab/cubrid-cookbook-python#316 ·
メンテナーはふだん 1 日以内に返信