selene-fmt
Python implementation of the Selene Data Format v1.0 — a compact, human-readable serialization format for configuration files and data interchange.
Install
pip install selene-fmt
Format overview
__sel_v1__
users [
{ name: "Rick" age: 43 }
{ name: "Sam" age: 56 }
]
products [
{ name: "Laptop" price: 999.99 }
{ name: "Mouse" price: 19.5 }
]
key: valueeverywhere — no exceptions{ }delimits records,[ ]delimits blocks- Strings must be double-quoted
- Unquoted tokens: numbers,
true,false,nullonly #comments- Duplicate keys within a record are an error
Python API
import selene
# Parse
data = selene.loads(text) # str → dict
data = selene.load(fp) # file → dict
# Serialize
text = selene.dumps(data) # dict → str
selene.dump(data, fp) # dict → file
# Validate
selene.validate(text) # raises SeleneError on failure
# Convert
json_str = selene.to_json(text, indent=2) # Selene → JSON
sel_str = selene.from_json(json_str) # JSON → Selene
Example
import selene
src = """
__sel_v1__
users [
{ name: "Rick" age: 43 }
{ name: "Sam" age: 56 }
]
"""
data = selene.loads(src)
# {'users': [{'name': 'Rick', 'age': 43}, {'name': 'Sam', 'age': 56}]}
print(selene.to_json(src, indent=2))
# {
# "users": [
# {"name": "Rick", "age": 43},
# {"name": "Sam", "age": 56}
# ]
# }
Errors
All errors raise selene.SeleneError with a descriptive message including the line number:
try:
selene.loads(bad_input)
except selene.SeleneError as e:
print(e) # Line 4: duplicate key 'name' in record
CLI
# Validate a Selene file
selene validate myfile.sel
# Convert Selene → JSON
selene to-json myfile.sel --indent 2
# Convert JSON → Selene
selene from-json myfile.json --indent 4
Nested objects
src = """
__sel_v1__
users [
{
name: "Rick"
age: 43
address: { city: "London" zip: "12345" }
}
]
"""
data = selene.loads(src)
# data['users'][0]['address'] == {'city': 'London', 'zip': '12345'}
License
SOCL
Metadata
Release files for selene-fmt 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| selene_fmt-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for selene_fmt-1.0.0-py3-none-any.whl |
Release files / selene_fmt-1.0.0-py3-none-any.whl
| Download URL | selene_fmt-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04b4c8f16cdd346236b943952da8d19dc5c20a835a83dad83091a61846400c80
|
|
BLAKE2b-256 checksum How to use checksums |
577346462eaa22296ece18f07f64d1ecb576e0f17171ca2410d4e9293d5c000e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for selene-fmt 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.