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.0.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.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: steflib-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 ce39d9c8316f8248fcab96184d66d9dc12dcfa33d6ba8e1cdb2761a89d60ccc7
MD5 37bc6a554078696828da01c780f971c4
BLAKE2b-256 380f5503d0a1a473fb5b631ba6d22134ea01c513ab0b6057045f0553720421eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: steflib-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 133c3777187e6784a5bf5d3b9c215c07a6db6b8398abb606ff321b526007bc2f
MD5 b3294c8c259cdc5efcd3abe0189f973e
BLAKE2b-256 1152ebb6c931c0891305e0c27d697b63a05ab2114cc31f4689df1cff094aca57

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