A simple script that cythonizes your python project, handles import statements, so you still can use normal packaging tools like PyInstaller to bundle your project.
- pip install cython-compiler
or the manual way:
- git clone https://github.com/JessicaTegner/cython-compiler.git
- cd cython-compiler
- python setup.py install
usage: cython-compiler [-h] [-c] [-r] [-e ENTRY]
Cythonize your entire project while keeping the easyness of packaging with PyInstaller and testing with an interpreted language.
optional arguments:
optional arguments: -h, --help show this help message and exit -c, --cythonize Cythonize your project and assemble imports. -r, --remove Remove the .pyd files, so you can test with python. -e ENTRY, --entry ENTRY The entry file that starts the program when ran with python. This file will not be cythonized.
- Install the Cython compiler.
- Go to the project you want to cythonize.
- If not done already, change the main file of your program, so i t contains a main method that starts the application.
- Make sure your entrypoint looks something like this.
import __required_imports__ # this will be generated by the cython cimpiler later.
import main_application # this is where your def main function is located, the method, that actually starts your application.
if __name__ == "__main__":
main_application.main() # asuming that your method is called main.
- run "cython-compiler -c -e program.py", where program.py is the entry of your application (look at the template above).
- After the cython compiler is done, test to see if it works with python program.py (if everything goes as planned, your program should start as normal).
GNU LESSER GENERAL PUBLIC LICENSE Version 3 For more information see the license file found in this repository.