Zyntex - Zig code parser for Python
Zyntex is a Python library that allows you to parse and generate Zig code at a high level. Function bodies and other low-level elements are currently returned as raw strings. Currently, it can parse Zig code written in version 0.15.1 - the supported parsing version will be continuously updated in the future.
Internally, it uses bindings to Zig's std AST parser, making it both fast and memory-efficient.
Important: currently bindings are only available for windows-x86_64, macos-x86_64, and linux-x86_64.
For more information, read the docs.
Be aware that the project is at a very early stage of development and is actively being developed.
Features
- Parse Zig source from strings or files.
- Code generation - emitting Zig code from Python objects via premade printers.
- High-performance, low-memory parsing powered by Zig’s
stdparser. - Easy-to-use, Pythonic API designed for inspection Zig code.
- Zero-dependency - the project requires no external dependencies on either the Zig side or the Python side.
Installation
pip install zyntex
Minimal example
from typing import cast
from zyntex.code_generation.premade import DefaultCodePrinter
from zyntex.parsing.syntax import VariableDeclaration
from zyntex.parsing import SourceCode
code_printer = DefaultCodePrinter()
src = SourceCode("const result: usize = 15 + 15;")
variable = cast(VariableDeclaration, src.content[0])
variable.is_public = True
print(code_printer.print(src)) # pub const result: usize = 15 + 15;
Metadata
Release files for zyntex 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zyntex-0.2.3.tar.gz | 27.6 kB | Without provenance | Details for zyntex-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zyntex-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for zyntex-0.2.3-py3-none-any.whl |
Total release size: 1.2 MB
Release files / zyntex-0.2.3.tar.gz
| Download URL | zyntex-0.2.3.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98c1604541438cfa1457c18c024abf99d8ef73cfe18e0cc826921de238fd18d1
|
|
BLAKE2b-256 checksum How to use checksums |
f9d0443bd28671414613301350d5378d85c651d9f08adc79b45ad1e1c76f53c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / zyntex-0.2.3-py3-none-any.whl
| Download URL | zyntex-0.2.3-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57eb11aa0bf9a209e8d586cbd228f3ca867557bc141036c024be011f8560f09c
|
|
BLAKE2b-256 checksum How to use checksums |
d00e0add387b298153059057d69f18d80e0bc7cf258741507027dd878da68ce3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Security for zyntex 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.