Skip to main content

Python implementation of STEF (Simple Token-Efficient Format)

Project description

steflib

Python implementation of STEF: the Simple Token-Efficient Format.

For more details on the format and a full specification, visit stef.nige.tech.

Installation

pip install steflib

Usage

>>> from steflib import stef
>>> from datetime import date
>>> print(stef({"name": "David Bowie", "born": date(1947, 1, 8), "studio_albums": 26}))
name: "David Bowie"
born: 1947-01-08
studio_albums: 26

For streaming output, use the StefWriter directly:

>>> from steflib import StefWriter
>>> from datetime import date
>>> writer = StefWriter()
>>> writer.print({"name": "David Bowie", "born": date(1947, 1, 8)})
>>> writer.print({"name": "Sting", "born": date(1951, 10, 2)})

Plain Python types are mapped to their STEF equivalents automatically. For additional control, typed wrappers are provided - for example, to emit an integer in hexadecimal, or to attach a comment to any value:

>>> from steflib import stef, Integer, Float
>>> print(stef(Integer(255, as_hex=True)))
0xFF
>>> print(stef(Float(3.14, comment="approx")))
3.14 (approx)

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

steflib-0.2.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

steflib-0.2.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file steflib-0.2.1.tar.gz.

File metadata

  • Download URL: steflib-0.2.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.1","id":"xia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for steflib-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6bf08c29dc148d7de249602434212d03ce7ec630920ad0e646cb59bfe2f221e3
MD5 73c2b25dda7ad4e5bc62f32a5d592344
BLAKE2b-256 704cc1dad813ab08c113adacb4c4bf1320d7655eeb32f1d8c7d48dda9a9f0578

See more details on using hashes here.

File details

Details for the file steflib-0.2.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for steflib-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2103a11c520d5390f543156abaa16cb056fb3ef210a640d302a5d512940c3f28
MD5 a681994f48979ca5094ebc66e4db90be
BLAKE2b-256 727937a7033d21479e335673405fe370eb8b3285b9e1ead56064b2badf013117

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