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.1.tar.gz
(23.1 kB
view hashes)
Built Distribution
thsl-0.1.1-py3-none-any.whl
(13.2 kB
view hashes)