-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Cython pure Python mode #13982
Comments
It is something I have thought about in the past. I think it would be neat but not sure the best way to do it. It's of course relatively straightforward to circumvent the issue by hand-rolling the transpile step using custom targets and |
I guess change https://github.com/mesonbuild/meson/blob/master/mesonbuild/compilers/compilers.py#L69 is OK. |
I'm not sure that associating IIRC there are also potential backwards compat issues, because My sense is that supporting this via |
Transonic is new to me. It and pythran seem like quite reasonable things to want to do in addition to cython. mypyc is a dead end, I'm afraid. Despite years of interest they are still impossibly heavily bound to the use of setuptools as a low-level implementation detail of their transpilation pipeline. They also require running exhaustive full-project type checking and then non-reproducibly generate the transpiled C source, so repeatedly rerunning setuptools.setup() build_ext will repeatedly recompile the entire project (with every single module in your project in one file, imported via capsules!) based on an arbitrary content hash (by which I mean the unified module that contains the entire project uses a hash as the import name for all the stubs to derive a capsule from). I don't see any interest from them in supporting external build system integration.
Well, a possible/plausible enhancement opportunity is to add direct support for specifying a generator, e.g. py.install_sources(
'foo.py',
'bar.py',
cythonize: get_option('python.can_cythonize'),
) |
Hmm, interesting idea. Tacking it only Another option that came to mind as a merger of the two ideas above. Add a |
That sounds pretty neat, actually. |
Cython supports a pure Python mode where code annotations are used to add Cython types to otherwise valid Python code. This allows to have modules that can be imported as Python modules or compiled into extension modules. The filename extension for this modules is
.py
to allow them to be imported by Python. Currently, Meson does not recognize.py
files as valid source code for Cython.Should the
.py
extension be added to the list of extensions handled by Cython? The drawback of doing so is that someone my accidentally pass Python source code files to a compilation target and get surprising results instead than an error.The text was updated successfully, but these errors were encountered: