A JSON-like configuration format supporting native Base32, Base58, and Base64 data types, with Teaser RUI-style ;; comments.
Project description
BXSON: Base-X Structured Object Notation
💡 What is BXSON?
BXSON (Base-X Structured Object Notation) is a superset of JSON designed specifically for applications that frequently handle binary data alongside standard structured metadata (strings, numbers, booleans). It treats Base32, Base58, and Base64 as first-class citizens in the syntax, eliminating the need to wrap them in standard JSON strings.
This project was developed internally by Teaserverse to streamline configuration and asset management across various backend services.
Key Features
-
First-Class Base-X Types: Define binary data blocks directly in the syntax:
b32{...},b58{...}, andb64{...}. -
Teaser RUI Comments: Supports single-line comments using the
;;syntax. -
Clean Output: The built-in decoder automatically converts these blocks into native Python
bytesobjects.
💾 Installation
BXSON requires the ply (parser generator) and base58 libraries.
pip install bxson
📜 BXSON Syntax Example (config.bxson)
;; The Teaser RUI comment style is simple and distinctive.
{
"api_version": 1.1,
"service_active": true,
;; --- Base64 (Standard binary asset) ---
"default_icon_png": b64{
iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAA
},
;; --- Base58 (Used for Crypto/Wallet addresses) ---
"blockchain_key": b58{
HwM8GgB1hS24u539Dq8R27R7Pz381P71P81d9A
},
;; --- Base32 (Used for case-insensitive identifiers) ---
"auth_token_32": b32{
JBSWY3DPEHPK3PXP
},
"metadata": [1, 2, "test", null]
}
💻 Usage
The bxson module provides a familiar Python API (load and loads) similar to the standard json library, plus a powerful decode function.
- Reading and Decoding Data
import bxson
import os
# 1. Load from a file
with open('config.bxson', 'r') as f:
# 'data' contains structure with special {'$bxson_type': 'b64', 'data': '...'} tags
data_structure = bxson.load(f)
# 2. Decode the structure to convert Base-X tags into Python 'bytes' objects
decoded_config = bxson.decode(data_structure)
# Accessing decoded bytes:
icon_bytes = decoded_config['default_icon_png']
print(f"Icon data type: {type(icon_bytes)}")
# Output: Icon data type: <class 'bytes'>
- Command Line Tool
You can also use the module directly to validate and inspect files:
# Parse file and show the intermediate structure with tags
python -m bxson <filename.bxson>
# Parse and decode file (converting Base-X tags to bytes)
python -m bxson <filename.bxson> --decode
💖 Contributing
We welcome contributions and suggestions! Feel free to open issues or submit pull requests on the official repository.
Project details
Release history Release notifications | RSS feed
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 bxson-0.1.2.tar.gz.
File metadata
- Download URL: bxson-0.1.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64b98ceafba86b707eb21fe89c98b1e3c4c0f2a5f1ed30d4986c90b954bec928
|
|
| MD5 |
fe61b005961bb572e0011d2ef1bb2afb
|
|
| BLAKE2b-256 |
3583ccc1aa4a86b9ec91784fe23ddef73c691dffeb9ff782c6dc8b33ad2b92c8
|
Provenance
The following attestation bundles were made for bxson-0.1.2.tar.gz:
Publisher:
python-publish.yml on TeaserLang/bxson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bxson-0.1.2.tar.gz -
Subject digest:
64b98ceafba86b707eb21fe89c98b1e3c4c0f2a5f1ed30d4986c90b954bec928 - Sigstore transparency entry: 660578961
- Sigstore integration time:
-
Permalink:
TeaserLang/bxson@44e721c4284f66fb9079c1437d582ba607acadb6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/TeaserLang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@44e721c4284f66fb9079c1437d582ba607acadb6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bxson-0.1.2-py3-none-any.whl.
File metadata
- Download URL: bxson-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1eb7d6723063693d523c0f51e37689bd15915e2fb679c93aa07f14d2118ec7d
|
|
| MD5 |
721a4d24df698072c4178c1ceb6aecbc
|
|
| BLAKE2b-256 |
61bed49bd1746f8c9ea4988af12de5b936ec31818db4f9ac28e1ceb0b6dbe668
|
Provenance
The following attestation bundles were made for bxson-0.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on TeaserLang/bxson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bxson-0.1.2-py3-none-any.whl -
Subject digest:
a1eb7d6723063693d523c0f51e37689bd15915e2fb679c93aa07f14d2118ec7d - Sigstore transparency entry: 660578963
- Sigstore integration time:
-
Permalink:
TeaserLang/bxson@44e721c4284f66fb9079c1437d582ba607acadb6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/TeaserLang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@44e721c4284f66fb9079c1437d582ba607acadb6 -
Trigger Event:
release
-
Statement type: