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.2.tar.gz (7.1 kB view details)

Uploaded Source

File details

Details for the file cython_compiler-1.0.2.tar.gz.

File metadata

  • Download URL: cython_compiler-1.0.2.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.9.7

File hashes

Hashes for cython_compiler-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f1ce98513604ab2cd73bd7310be61a70106b705954fdc1b60a08795b764b2f2d
MD5 31f9733c7378775cb2b8041b9abef8aa
BLAKE2b-256 330e806588b3efcbfe79e467179c6a5d646de6ce6cd98209b76dab0d0fd1ca70

See more details on using hashes here.

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