Logo made with PowerRP. Open it in PowerRP to edit it (source: assets/doc.json).
dtab
Delta Tab. Config files made of tab-separated paths. One line is one path into a tree, and later lines are deltas on top of earlier ones. Try it in your browser: dtab on the left, JSON on the right.
objects l1,l2 light
deltas l1 position x 1 y .5
z -2
import dtab
dtab.parse(open("scene.dtab").read())
# {'objects': {'l1': 'light', 'l2': 'light'},
# 'deltas': {'l1': {'position': {'x': '1', 'y': '.5', 'z': '-2'}}}}
Why
-
Less to look at. No braces, quotes, or commas between values. A file with its tabs aligned reads like pseudocode, and is easy to write by hand, even on paper.
-
Simple. Six rules, one pass, about 70 lines per implementation.
-
Everything is addressable. There are no lists, so every value has a dotted path:
config.deltas.l1.position.xworks with EasyDict in Python and plain property access in JavaScript. -
You choose the shape. Lines stack, and
c,dwrites one value under several keys, so the same tree can be written wide, deep, or on one line, trading horizontal space for vertical. These are the same file:a b c x a b d xa b c x d xa b c,d x
Rules
- Tabs separate the steps of a path.
deltas l1 positionwalks three keys down. Several tabs in a row count as one, so you can align columns. - An entry with a space is
key value. It sets the key and stays at the same level, sox 1 y .5sets two keys. - An indented line continues the path of the line above it.
- Writing a key again replaces it. Writing into an object merges.
a,bwrites the same value underaand underb.- An entry that starts with a space is a comment.
$keystarts a multiline string. See below.
Every value is a string. Cast the ones you need. Keys are identifiers (letters, digits, underscores),
so attribute access like config.deltas.l1 works with EasyDict and friends.
Multiline strings
$key makes the lines indented under it the value, with their common indentation removed. Blank
lines inside are kept, trailing ones dropped.
$query sql
SELECT name, age
FROM users
WHERE age > 30
The word after the key is optional. It tells editors which language to highlight and is not part of the value. Unknown tags are plain text, never an error.
| Tag | Also |
|---|---|
sql |
|
python |
py |
javascript |
js |
typescript |
ts |
html, css, json, yaml, markdown |
yml, md |
bash |
sh, shell, zsh |
c, cpp, rust, go, java, swift |
|
dtab |
Install
- Python:
pip install dtabthenimport dtab - JavaScript:
npm install deltatabthenconst dtab = require('deltatab'), or<script src="https://cdn.jsdelivr.net/npm/deltatab/dtab.js">forwindow.dtab - Vim:
Plugin 'RyannDaGreat/dtab'(Vundle) orPlug 'RyannDaGreat/dtab'(vim-plug), or pastedtab.viminto your vimrc. Highlights*.dtab, flags bad keys and trailing tabs, and gives the file a Δ icon in NERDTree if vim-devicons is installed. - VS Code: search "dtab" in Extensions, or
code --install-extension RyannDaGreat.dtab. Highlighting plus a Δ file icon.
API
parse(text)returns nested dicts (Python) or plain objects (JavaScript). Raises on an invalid key, with the line number.stringify(tree)writes the tree back out, one key per line.- Command line:
dtab scene.dtabprints the tree as JSON.
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 dtab-0.2.0.tar.gz.
File metadata
- Download URL: dtab-0.2.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c4651cea3b38e07f5cf134ea95a3734fbb3c2bc7016f24aba4e19dbb368298c
|
|
| MD5 |
1f017ac217c651b53e6d57392e7794f0
|
|
| BLAKE2b-256 |
f660bfabe383a771df767a643bdbb515daf3ee0fef41907911014c41e2c851b2
|
File details
Details for the file dtab-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dtab-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfdd57ccf5d70702016af6643ef6f77d2290581c423b51ce186a312e34a1e23f
|
|
| MD5 |
e0768e4c19df2d7112e721e1c9946a14
|
|
| BLAKE2b-256 |
d5625e9f282816ed033d32e5cf10c55b52c95c8609f12f9cb55503de9e54ad37
|