A typed configuration language
Project description
thsl (Thistle)
Typed Human-friendly Serialization Language
A typed configuration language and serialization format. Imagine YAML with types.
Example
debug @bool: false
name @str: My Name
graphics:
target_framerate @int: 60
fullscreen @bool: false
resolution:
width @int: 1920
height @int: 1080
Indentation is done via tabs only
See sample.thsl for more.
Install
This is currently a beta level project
pip install thsl
Usage
>>> from pathlib import Path
>>> import thsl
>>> data = thsl.load(Path("data.thsl"))
{
'debug': False,
'name': 'My Name',
'graphics': {
'target_framerate': 60,
'fullscreen': False,
'resolution': {
'width': 1920,
'height': 1080
}
}
}
Features
Not finalized. Subject to change
- YAML like syntax
- Type safety (avoids the Norway problem)
- Comments
- Trailing commas
- String templating
- String escaping
- Compound types
- Dictionaries
- Lists
- Sets
- Tuples
- Scalar types
- Bools
- Ints
- Floats
- inf
- -inf
- -0
- nan
- Scientific notation
- Decimals
- inf
- -inf
- -0
- nan
- Scientific notation
- Strings
- Chars
- Binary
- Hexes
- Octals
- Base64
- encoding
- decoding
- Complex numbers
- Ranges
- exclusive
- inclusive
- Dates (with the help of the dateutil library)
- Times (with the help of the dateutil library)
- DateTimes (with the help of the dateutil library)
- Intervals (with the help of the tempora library)
- IP addresses
- URLs
- Environment variables
- Paths
- Semantic version numbers (using the semantic_version library)
- Regex
- Type addon system
- Dump to file
TODO
- Serialization
- String templating
- Something equivalent to yaml node anchors
- Custom type addons/plugins
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
thsl-0.1.3.tar.gz
(23.5 kB
view details)
Built Distribution
thsl-0.1.3-py3-none-any.whl
(13.3 kB
view details)
File details
Details for the file thsl-0.1.3.tar.gz
.
File metadata
- Download URL: thsl-0.1.3.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.4.9 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | addbd7e5c75d73c4bbd90efd282d4a52960c4d7d2ac14caf54bf79c270f43202 |
|
MD5 | 48a566173d626ad5d8b2fe5cbb2746f0 |
|
BLAKE2b-256 | 50b7b78f229d16153702ff10ac1d5e3379664adff53cf3421d629d463c77e063 |
File details
Details for the file thsl-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: thsl-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.4.9 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd8bc5c1f1c174d4f178a728e42280147ccaa4aa1cb008190b790118b13bf73a |
|
MD5 | 8fea1ead86e91c2ab41942d1f902c9a2 |
|
BLAKE2b-256 | 8f933c8485c02d7a7d8612d81c71906b03535c356287681748ad7ffc0c047248 |