Bring
A modern, human-readable file format for configuration and package management — combining the best of JSON, YAML, and XML while fixing their flaws.
# Install the Python parser pip install bring-parser # Parse a file from bring_parser import parse_bring_file data = parse_bring_file("config.bring")
Why Bring?
Modern configuration formats each have fundamental limitations. JSON lacks comments and schema validation. YAML introduces ambiguity and code-execution risks. XML is verbose and requires closing tags. Bring solves all of these in a single, secure format.
| Feature | JSON | YAML | XML | Bring |
|---|---|---|---|---|
| Human-Readable | ~ | ✓ | ✗ | ✓ |
| Supports Comments | ✗ | ✓ | ✓ | ✓ |
| Built-in Schema Validation | ✗ | ✗ | ~ (XSD) | ✓ |
| Inline Attributes/Metadata | ✗ | ✗ | ✓ | ✓ |
| No Ambiguity | ✓ | ✗ | ✓ | ✓ |
| Secure (no code exec) | ✓ | ✗ | ✓ | ✓ |
true is always true — not yes, on, or TRUE.schema blocks. No external XSD or JSON Schema files needed.@attr=value syntax — like XML attributes but cleaner.Syntax
Key-Value Pairs
The fundamental building block. Keys are bare identifiers or quoted strings. Values are separated by =.
# Primitives
name = "Bring"
version = 1.0
enabled = true
timeout = null
port = 8080
ratio = 3.14Objects
Nested key-value structures use curly braces. Objects can be nested to any depth. No commas required between entries.
server = {
host = "0.0.0.0"
port = 8080
ssl = {
enabled = true
cert_path = "/etc/ssl/cert.pem"
}
}Arrays
Ordered lists of any value type, including nested objects. Items are separated by commas.
allowed_ips = ["127.0.0.1", "192.168.1.0/24"]
features = [
{
name = "caching"
enabled = true
ttl = 3600
},
{
name = "analytics"
enabled = false
}
]Attributes @metadata
Attach inline metadata to any key-value pair using @attr=value syntax. Similar to XML attributes but cleaner — no closing tags required.
# Validation attributes
port = 8080 @min=1 @max=65535
username = "alice" @required=true @maxLength=32
email = "alice@example.com" @format="email"
amount = 100.50 @currency="USD" @min=0Schemas
Define validation rules directly in the file using schema blocks. Built-in, no external tools needed.
schema Product {
id = number @min=1
name = string @maxLength=100
price = float @min=0
tags = array
}
schema User {
id = number @required=true
username = string @minLength=3
email = string @format="email"
active = bool
}Comments
Line comments start with #. They work anywhere — top-level, inside objects, inside arrays.
# Top-level comment
database = {
# Primary database connection
host = "db.example.com"
port = 5432 # Default PostgreSQL port
}Try the Editor
Write Bring syntax on the left and see the parsed output on the right — live, with error highlighting.
Installation
pip install bring-parserfrom bring_parser import parse_bring_file
data = parse_bring_file("config.bring")
print(data["server"]["host"])bring parse config.bring --format=json
bring validate config.bring --schema=schema.bring
bring convert config.json config.bring