bazel-contrib / bazel-contrib/rules_python

Add support for building C extensions

オープン
#824 コメント 38 件 リアクション 10 件 担当者 0 名 GitHub で見る
Can Close? type: feature request
主要言語
Starlark
スター
688
フォーク
721
平均マージ
15時間 7分
マージ済み PR(30日)
76

説明

# 🚀 feature request

* [x] Add support for getting Python headers (Python.h) -- use `@rules_python//python/cc:current_py_cc_headers`
* [x] Provide shared libraries (libpython.so et al) -- use `@rules_python//python/cc:current_py_cc_libs`
* [ ] Provide static libraries (libpython.a)
* [ ] Add a rule/rules to build C extensions
* [ ] Add `PyInfo.cc_info` field to allow C/C++ info (CcInfo) to propagate (directly
propagating CcInfo it isn't done to prevent a Python target from
being accidentally accepted by a plain CC target)

### Describe alternatives you've considered

I've cobbled support for these things by hand in the past, was hoping building extension modules would be officially supported at some point.

Some projects, such as tensorflow and pybind11_bazel, have a python_configure.bzl file and/or py_extension rule that attempts to implement this.

(Note: this issue was originally about updating the readme to address the lack of this feature; it's been edited to be a feature request for this feature directly - rickeylev)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、既存の @rules_python//python/cc:current_py_cc_headers および current_py_cc_libs ターゲットを調査し、次に issue で言及されている python_configure.bzl と py_extension の実装を比較します。静的ライブラリ、C 拡張をビルドするルール、および CcInfo を伝播する PyInfo.cc_info フィールドを提供し、Python ターゲットが通常の C++ ターゲットに入り込まないようにできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, python
領域
build-system, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。