Skip to main content

Zserio runtime with compiler.

Project description

Zserio PyPi package contains Zserio compiler and Zserio Python runtime. Zserio is serialization framework available at GitHub.

Installation

To install Zserio compiler together with Zserio Python runtime, just run

pip install zserio

Usage from command line

Consider the following zserio schema which is stored to the source appl.zs:

package appl;

struct TestStructure
{
    int32 value;
};

To compile the schema by compiler and generate Python sources to the directory gen, you can run Zserio compiler directly from command line by the following command:

zserio appl.zs -python gen

Then, if you run the python by the command

PYTHONPATH="gen" python

you will be able to use the generated Python sources by the following python commands

import appl.api as api
test_structure = api.TestStructure()

Usage from Python

Consider the following zserio schema which is stored to the source appl.zs:

package appl;

struct TestStructure
{
    int32 value;
};

To compile the schema by compiler and generate Python sources to the directory gen, you can run the following python commands:

import zserio
api = zserio.generate("appl.zs", gen_dir = "gen")
test_structure = api.TestStructure()

For convenience, the method generate returns imported API for generated top level package.

Alternatively, you can run zserio compiler directly by the following python commands:

import sys
import importlib
import zserio
completed_process = zserio.run_compiler(["appl.zs", "-python", "gen"])
if completed_process.returncode == 0:
    sys.path.append("gen")
    api = importlib.import_module("appl.api")
    test_structure = api.TestStructure()

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

zserio-2.15.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

zserio-2.15.0-py3-none-any.whl (4.7 MB view details)

Uploaded Python 3

File details

Details for the file zserio-2.15.0.tar.gz.

File metadata

  • Download URL: zserio-2.15.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for zserio-2.15.0.tar.gz
Algorithm Hash digest
SHA256 da76109bd8455c201388ea74a4e38e6ee14645007dfd9af1c184efcc40fe7302
MD5 cc30537610cbbbee450ec22a733511b5
BLAKE2b-256 80738abe53c81fb6d19e7cf44514a3f8f9b28568c95749373fc3b4c4a73e7e92

See more details on using hashes here.

File details

Details for the file zserio-2.15.0-py3-none-any.whl.

File metadata

  • Download URL: zserio-2.15.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for zserio-2.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4a0f284f576bbfed1421dc34394f6758ae28c8ab5150f89a351dfdbf52d4451
MD5 bec6e3744d27f95ca25efc2f53636737
BLAKE2b-256 17a1449c29cfe98a8f41d2f01ec987700df731555a5a7453907a56ff8e0a0b20

See more details on using hashes here.

Supported by

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