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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file steflib-0.2.2.tar.gz.
File metadata
- Download URL: steflib-0.2.2.tar.gz
- Upload date:
- Size: 7.0 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14686ae1ccca4d40dd878993cc7105c646fe78fb07d0a7f81f24544ebda7f4e0
|
|
| MD5 |
ddf1ca25fe988a4723b036cdf85b8c24
|
|
| BLAKE2b-256 |
a433987e1d35b33eaaf858e34fe95f2e976c38da66d08995fbb4c4fb17889157
|
File details
Details for the file steflib-0.2.2-py3-none-any.whl.
File metadata
- Download URL: steflib-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.9 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac8dbae2fecd1764d8e3efc2e9d205fce48cdff8b85b669bc8d3465b481eaf9c
|
|
| MD5 |
d32e14267aecc67c7b6698acbcb31bac
|
|
| BLAKE2b-256 |
1fefdcc91165d8b28559256244fed6a924920334670a8fe038a3decbf0d8a4a0
|