bazel-contrib / bazel-contrib/rules_python

Add support for building C extensions

未关闭
#824 38 条评论 10 个 reaction 已指派 0 人 在 GitHub 查看
Can Close? type: feature request
主要语言
Starlark
星标
688
派生
721
平均合并
15 小时 7 分钟
30 天内合并 PR
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
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。