hello, i’m looking into integrating cython with pa...
# general
b
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
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
And then you'd use
resource
/
resources
targets for the
.pyx
files, right?
b
ah you’re right, worked as soon as i included the pyx files as resources in the BUILD
h
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
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