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 dumps
>>> from datetime import date
>>> print(dumps({"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 dumps, Integer, Float
>>> print(dumps(Integer(255, as_hex=True)))
0xFF
>>> print(dumps(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.1.0.tar.gz (5.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.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: steflib-0.1.0.tar.gz
  • Upload date:
  • Size: 5.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.1.0.tar.gz
Algorithm Hash digest
SHA256 184c209d7684abe906cb7b553ba42ef9000f79615641aa7acd3db944c0c132b9
MD5 ed4cd4179e230bf9617c549d2ef6d03f
BLAKE2b-256 5986a8943dc1c2e6645c66552d7267fd6153690eadb475f768a82aaebad4de35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: steflib-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae28a02e742256d4092b0b4a2eaabe19debfb29f8f03d80c9bc9552829cb9cd8
MD5 8b7f6d7b03ba46d672a64c8862160059
BLAKE2b-256 7b269b8e24eda21ee2d24231d2a4a62c4f5027f4d8e5b7c866bf50873dbd5072

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