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.1.tar.gz (7.6 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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyzon-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pyzon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f2a1e77263bc257fed6bf03abf1533f8e2f0976d1f589c1eafea6d2c57288a3c
MD5 d24786a9911d1259b17ef7b7ee7f26f0
BLAKE2b-256 bfee7d63dad403daf73da99dcb40fe539c6842518711b53a6e45f9b2adfebf79

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyzon-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pyzon-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8af7eea07d372db82f1ccb3b338b05e3ef5c238a6829aeaf6cea812b362146ca
MD5 2ef4a406c9ac8c891944454a3ead7800
BLAKE2b-256 edbf2c86b617448f2c155c307b9bbc808d53d58665aaacfacb51259c5613f953

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