Skip to main content

Zig Object Notation parsing library written in pure Python

Project description

PyZon

a standalone python parser for the Zig Object Notation format from the Zig Programming Language.

At the moment the library only supports reading Zon file

How to use

import pyzon

with open("build.zig.zon") as fp:
    pyzon.load(fp)
# {.name: .zig, .version: '0.0.0', .dependencies: {.standalone_test_cases: {.path: 'test/standalone'}, .link_test_cases: {.path: 'test/link'}}, .paths: [''], .fingerprint: 13965117641364839958}

pyzon.loads(".{1, .b, \"b\", 'c'}")
# [1, .b, 'b', 'c']

pyzon.dumps({"name": pyzon.EnumLiteral("test"), "version": "0.0.0"})
# '.{.name = .test, .version = "0.0.0"}'

Limitations

PyZon was only intended to ever parse build.zig.zon files and may not support everything expressable within a Zon file however it is also a bit more lax and can parse zon files that Zig itself will reject, for example in the case of keywords being used in literals.

If you find a zon file that does not parse correctly please open an issue to document this and give me the ability to fix it.

License

PyZon uses the MIT License

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

pyzon-0.1.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyzon-0.1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pyzon-0.1.2.tar.gz.

File metadata

  • Download URL: pyzon-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyzon-0.1.2.tar.gz
Algorithm Hash digest
SHA256 11df1efceb5cb5932ca4beb5c93b4f26adff7517085ef544b78c9d329842bf06
MD5 a744d88fd6e16b8d1921d6f9d975ec24
BLAKE2b-256 29b9cc84f377a89c065cb028463ab69da04f3d82d6096e6271740fea25cd808d

See more details on using hashes here.

File details

Details for the file pyzon-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyzon-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyzon-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13cbfb999aa559d55fe784cec7eba6346502cb7b1594a210cc68e1f99f5f210f
MD5 79bef2c8374c3dc3fa78db18a0e5cd20
BLAKE2b-256 296496c4ec5712725c3d184947d4f7a95f38ba45ef70456e023b120d61910059

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page