compile python to ELF - Cython based compiler
Project description
pycc-compiler
Compile Python/Pyrex files to standalone ELF executables/shared libraries using Cython and clang.
Installation
pip install pycc-compiler
Or from source:
git clone ...
cd pycc-compiler
pip install .
Dependencies
· Python 3.8+ · Cython · clang (or clang++)
On Termux:
pkg install clang cython python-dev
Usage
Basic Compilation
pycc main.py # generates ./main.out
pycc main.py -o prog # generates ./prog
pycc -run main.py # compile and run
Generate C/C++ Code
pycc -c main.py -o main.c # generate C file
pycc -cpp main.py -o main.cpp # generate C++ file
Shared Libraries
pycc -so main.py -o lib.so # generate shared library
pycc -s -so main.py # install to site-packages
C/C++ Files
pycc --clang main.c -o prog # compile C file
pycc --clang main.cpp -o prog # compile C++ file
Interactive Mode
pycc -i
P>> import numpy as np
P>> x = np.array([1,2,3])
P>> print(x)
P>> RUN
Options Option Description -O0, -O1, -O2, -O3 Optimization level -o, --output Output file name -run Compile and run -c Generate C file -cpp Generate C++ file -so Generate shared library --site, -s Install to site-packages -i, --interactive Interactive mode -v Verbose mode -q Quiet mode --clang, -clg Forward to clang/clang++
Environment Variables
· PYCC_PY_VERSION - Specify Python version (auto-detected)
Features
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycc_compiler-1.4.11.tar.gz.
File metadata
- Download URL: pycc_compiler-1.4.11.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875941a5bb65fe5a3f2f15d59473c685123a9b46c6324896d8d01a71af93dd61
|
|
| MD5 |
f3740f7fff369f8020ac5ba69718a32e
|
|
| BLAKE2b-256 |
de9e05204cf764f8f4583e92289481d18d6669b3e4194a2ea2eed6242e49de7d
|
File details
Details for the file pycc_compiler-1.4.11-py3-none-any.whl.
File metadata
- Download URL: pycc_compiler-1.4.11-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff892978d8c40210de168a38e2d7c2f1b1590a2374072aceff25672070bf9176
|
|
| MD5 |
570b741a1d5025e11115aa9d7772022a
|
|
| BLAKE2b-256 |
191e21526acf719f942c81989137051c1a3ad411a54e78d22c3eb094e2a6d308
|