Incorporating Cythonized shared library files in the build workflow #17718
Replies: 7 comments 20 replies
-
@alexey-tereshenkov-oxb replied: welcome! 🙂 Let's brainstorm!
Right, so you are thinking of
So the PEX files are not related to the |
Beta Was this translation helpful? Give feedback.
-
I believe someone has written a cython plugin for internal use, but I don't recall who. I just see it mentioned as an example here: https://www.pantsbuild.org/docs/how-does-pants-work#a-powerful-plugin-system |
Beta Was this translation helpful? Give feedback.
-
Ah, here is more context: #14752 |
Beta Was this translation helpful? Give feedback.
-
@erickpeirson I know little about Cython, but are you just using it to speed up otherwise-pure-python code in .py files? Or are there also .c source files involved? |
Beta Was this translation helpful? Give feedback.
-
I'll chew on this a little before throwing down opinions... |
Beta Was this translation helpful? Give feedback.
-
I'm still getting my head around the Pants architecture, so this may be a total red herring, but it feels like there is a similarity here to Protobuf code generation: https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/codegen/protobuf/python/rules.py |
Beta Was this translation helpful? Give feedback.
-
Hi @benjyw, thanks for all the work in Pants. It's a nice tool to use! We have a similar requirement in our project, to generate
I guess the difference between the Cython plugin and the Protobuf example is that we are generateing Edit: seems one needs to define the type for |
Beta Was this translation helpful? Give feedback.
-
Moving this over from Slack
Hey folks, I have a use case in Python that I suspect isn't terribly special, and I wonder if folks could point me in the right direction.
I have a codebase with a large library, and a handful of applications that use the library. The final distribution target is a container image, and I'm hoping to build the application itself as a Pex. When we ship the final build, the modules in the library are cythonized to shared library files. We do this today via setuptools
build_ext
, and implement our own cache so that we only rebuild modules that have changed. I can define a distribution target for the library in Pants that triggers thebuild_ext
routine, but in this case our cache doesn't work. And when building the Pex, I'd like to bring along just those shared library files that are required and not the whole boatload.It seems like what I want is to be able to define a target for each eventual shared library file, with dependencies looking something like:
Before I dive too deep into the plugin framework, any pointers or feedback? If I were to go the route of writing a plugin, any words of advice for how to think about this?
Beta Was this translation helpful? Give feedback.
All reactions