Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

Files for cython-compiler, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size cython_compiler-1.0.1.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page