https://pantsbuild.org/ logo
#general
Title
# general
b

bitter-ability-32190

11/09/2021, 3:05 PM
How should one go about handling building a Python C Extension Module? Is there a mechanism in-ecosystem to do this, or is it more of a "do-it-outside-of-pants" thing?
c

curved-television-6568

11/09/2021, 3:09 PM
I’m no expert here, but I think if you provide your own setup.py, pants can use that, and in that way build native extensions.. It is mentioned here: https://www.pantsbuild.org/v2.8/docs/python-distributions#setuppy
b

bitter-ability-32190

11/09/2021, 3:17 PM
worth a shot
h

happy-kitchen-89482

11/09/2021, 5:21 PM
Yep, Pants 2.8 will build your native extensions from a custom setup.py
That would be the standard way at present
In the future I could imagine supporting C/C++ and/or Rust as a first-class language in Pants and shimming a linked binary into a native extension, but usually native extensions are small and probably don't require that much overkill