Skip to content

Add support for building C extensions#824

Description

@blais

馃殌 feature request

  • Add support for getting Python headers (Python.h) -- use @rules_python//python/cc:current_py_cc_headers
  • 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions