https://github.com/joegasewicz/cython-starter-template
Starter template to create Python bindings from a C static library
https://github.com/joegasewicz/cython-starter-template
cython cython-template python-bindings
Last synced: 5 months ago
JSON representation
Starter template to create Python bindings from a C static library
- Host: GitHub
- URL: https://github.com/joegasewicz/cython-starter-template
- Owner: joegasewicz
- Created: 2024-02-23T17:56:08.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-23T18:37:31.000Z (over 2 years ago)
- Last Synced: 2025-04-05T07:13:50.356Z (about 1 year ago)
- Topics: cython, cython-template, python-bindings
- Language: Makefile
- Homepage:
- Size: 4.88 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cython Starter Template
Starter template to create Python bindings from a C static library
### Quick Start
First create & activate a virtual environment & install the python packages
```bash
pip install -U pip setuptools # install or update setuptools package
virtualenv -p python3 .venv
source .venv/bin/activate
pip install -r requirements.txt
```
Then build the source C static lib, generate the Python bindings
& run `main.py`.
```
make build_lib
make build
make run
```
You should see the follow output
```bash
hello!
```
### C Static Library
The C static library source code is located in the `lib` directory.
To build your C static library run the following command:
```bash
make build_lib
```
To clean the lib directory run:
```bash
make clean_lib
```
### Generate Python bindings
To build the bindings run:
```bash
make
```
To clean all Cython generated files run:
```bash
make clean
```
### VirtualEnv
Your virtual environment should be named `.venv`