Skip to main content

Zyntex - Zig code parser for Python

Downloads License Python Version Zig

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 std parser.
  • 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;

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)

Source distribution for zyntex 0.2.3
File Size Uploaded
zyntex-0.2.3.tar.gz 27.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zyntex 0.2.3
File Interpreter ABI Platform
zyntex-0.2.3-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.1.3

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page