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

better-church-90898

12/21/2021, 7:49 PM
hello, i’m looking into integrating cython with pants. i’ve seen a couple previous questions in this channel about the topic and wonder if there’s any updates with that. the project currently uses
pyximport
to build the simple library rather than using setuptools - is it possible to configure pants to support this workflow without a custom plugin?
e

enough-analyst-54434

12/21/2021, 8:10 PM
Do you use pyximport at runtime? As outlined here: https://docs.cython.org/en/latest/src/userguide/source_files_and_compilation.html#compiling-with-pyximport If so, Pants is really out of the picture at that point and this should work fine like any other runtime library.
h

hundreds-father-404

12/21/2021, 8:37 PM
And then you'd use
resource
/
resources
targets for the
.pyx
files, right?
b

better-church-90898

12/21/2021, 8:38 PM
ah you’re right, worked as soon as i included the pyx files as resources in the BUILD
h

hundreds-father-404

12/21/2021, 8:38 PM
as we say in Pants slack, coke (ditto)
You may want to define a macro like
cython_sources
that is an alias for creating `resources(name="cython", sources=["*.pyx"])`: https://www.pantsbuild.org/docs/macros
👍 1
Hey @calm-ambulance-65371 and @modern-wolf-36228, iirc you both are using Cython. I hadn't known about
pyximport
until now and how easy it is to integrate with Pants What do you (and @better-church-90898) think about me adding a "Cython" page to
Python -> Integrations
in our docs focusing on
pyximport
? I think I'm wondering how common it is to use that vs. the setup-py approach
b

better-church-90898

12/22/2021, 4:15 AM
i’m not sure which is more common, but the docs recommend using a setup.py, which is much more powerful and customizable than pyximport
👍 1
7 Views