plain-fireman-49959
03/09/2022, 9:37 AMcythonize
some files using Pants. These are my attempts so far using a python_distribution
target:
• Dist has only dependencies
on the source package, uses a generated setup.py
and provides=python_artifact
, I can build a package (without cython ofc)
• Adding a pyproject.toml
dependency (requiring ["setuptools", "wheel", "Cython"]
does create a target, but it doesn't cythonize
files
• Adding a minimal setup.py
with _ext_modules_=cythonize([Extension("*", ["*.pyx"])])
produced this error: ValueError: '*.pyx' doesn't match any files
Has anyone dealt with this before? The .pyx
file lives at the same level as the setup.py
, I tried globbing with directories too (src/test/test.pyx
) without success.
I can provide more details if required, this setup is as minimal as I can get it (even though it's part of a bigger project)curved-television-6568
03/09/2022, 9:42 AMfiles
target perhaps: files(name="pyx-sources", sources=["*.pyx"])
and add a dependency on that from your python_distribution
.
Running with --no-process-cleanup
and inspecting the sandbox packaging your dist may give you valuable insights as you can inspect what goes into the sandbox, and the command invoked to package it.plain-fireman-49959
03/09/2022, 9:48 AMresources
instead of files
happy-kitchen-89482
03/09/2022, 8:56 PMcython_sources
target to glob over *.pyx files, and it might be possible for the generated setup.py to add the ext_modules=
automatically.plain-fireman-49959
03/09/2022, 9:17 PMpants run
ing another with a cython distribution as a dependency, I'll sort it out soon though! I'll try to open an issue tomorrow or next weekhappy-kitchen-89482
03/09/2022, 9:48 PMplain-fireman-49959
03/10/2022, 9:38 AM.pyx
files, but I'd like to expand it to support more feature (see README).
https://github.com/houtenjack/pants-cython-minimal-example
An issue in the pants repo will follow soon!wide-midnight-78598
03/10/2022, 2:03 PMmypyc
plugin I've been sorta working on as well.
I think it would be handy to be able to auto-generate full setup.py
for plugins that need to do more manipulation than just kwargs
I do like the idea of having a custom target field that will automatically add it to the setup.py
though, but from the side of creating sample plugins (like I like to do), I think w're missing a bit of functionality
https://github.com/pantsbuild/pants/issues/14752#issuecomment-1064089880