Skip to main content

Cythonize your project, securing it's source, while still be able to test with python and bundle with PyInstaller

Project description

Cython Compiler

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.

Installation

  • pip install cython-compiler

or the manual way:

Quick Usage (see below for a detailed tutorial)

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.

Detailed tutorial

  1. Install the Cython compiler.
  2. Go to the project you want to cythonize.
  3. If not done already, change the main file of your program, so i t contains a main method that starts the application.
  4. 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.
  1. run "cython-compiler -c -e program.py", where program.py is the entry of your application (look at the template above).
  2. 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).

License

GNU LESSER GENERAL PUBLIC LICENSE Version 3 For more information see the license file found in this repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cython_compiler-1.0.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page