Skip to content
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

Add Option to mypyc to only Generate and Output C Code #1047

Open
srilman opened this issue Feb 7, 2024 · 0 comments
Open

Add Option to mypyc to only Generate and Output C Code #1047

srilman opened this issue Feb 7, 2024 · 0 comments
Labels
feature Supporting previously unsupported Python, new native types, new features, etc.

Comments

@srilman
Copy link

srilman commented Feb 7, 2024

I'm using scikit-build-core to build a fairly large Python project with multiple C++ files. There are some Python files that I want to optimize, so I'm using Cython. scikit-build-core doesn't have a special plugin for Cython like setuptools, so I'm just using the CLI. Something like:

cython -3 --output-file ${CMAKE_CURRENT_BINARY_DIR}/pkg pkg/module.py

This generates a .c & .h file that CMake can keep track of. I wanted to migrate some of these modules to MyPyC since I'm seeing better performance, but there isn't a CLI option to do something similar. I was able to hack something together like:

python -c "from mypyc.build import mypycify; mypycify(['pkg/module.py'])"

But it would be helpful if I could do the same from the mypyc command. Maybe adding a subcommand or different option to specify that we only need the C file, and where to put it? What do y'all think?

@JukkaL JukkaL added the feature Supporting previously unsupported Python, new native types, new features, etc. label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Supporting previously unsupported Python, new native types, new features, etc.
Projects
None yet
Development

No branches or pull requests

2 participants