Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkashirin/pyzig
Elementary Python extension built with Pydust.
https://github.com/mkashirin/pyzig
Last synced: 22 days ago
JSON representation
Elementary Python extension built with Pydust.
- Host: GitHub
- URL: https://github.com/mkashirin/pyzig
- Owner: mkashirin
- Created: 2024-12-05T13:32:06.000Z (30 days ago)
- Default Branch: main
- Last Pushed: 2024-12-06T02:24:22.000Z (29 days ago)
- Last Synced: 2024-12-06T03:22:54.357Z (29 days ago)
- Language: Zig
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PyZig
Create Python native extensions using Zig and Python C API!## Usage
First, create and activate a virtual environment and install dev dependencies
(using UV and bash):
```sh
uv venv ".venv"
source ".venv/bin/activate"
uv pip install -r "pyproject.toml" --extra "dev"
```### Manual Build and Installation
Then build a shared library file by executing:
```sh
zig build
```
The Python package can be now built and installed like so (using UV):
```sh
uv build
uv pip install "."
```### Automated Build and Installation
Use `ZIG_INSTALLED` environment varibale to specify what type of Zig compiler
to use (unset is for Python Ziglang module, 1 is for system-wide installed
binary). Then create and activate a virtual environment (example above). After
that, run the build shell script:
```sh
bash "build_python_library.sh"
```### Testing
Once the installation is complete, the test can be run as follows:
```sh
python "tests/test_summodule.py"
```Have fun!
## TODO
* Generate stubs automatically
* Build some Zig API for more convinient interaction with Python C API.