nano-ini
Tiny .ini → dict reader — ~1 KB, zero deps.
Supports key=value and [section]; outputs JSON (dict). Perfect for code-golf, minimal containers, or just for fun.
✨ Features
- ✅ Sections:
[database],[app]… - ✅ Keys:
key=value(whitespace trimmed) - ✅ Full-line comments:
;or# - ✅ Root keys (before any section) stored under empty section
"" - ✅ Zero dependencies • single tiny file • CLI included
🚀 Usage
; sample.ini
name = nano
[database]
host = localhost
port = 5432
# Local (from repo)
python app_min.py sample.ini
# {"":"","database":{"host":"localhost","port":"5432"}}
python app_min.py sample.ini database
# {"host":"localhost","port":"5432"}
# stdin
cat sample.ini | python app_min.py
After installing:
# CLI
pip install nano-ini
nano-ini sample.ini # full JSON
nano-ini sample.ini database # one section
🤓 Why so small?
- Pure stdlib, hand-rolled parser (no configparser dependency)
- Minimal rules: key=value, [section], full-line comments only
- Dumps compact JSON with separators=(',',':')
Notes:
- Values are kept as strings (no auto-casting or interpolation).
- Inline comments (key=val ; note) aren’t parsed specially (keep them out of value lines).
🎉 Fun Ideas
- Grab a single value (host)
nano-ini config.ini database | jq -r .host
(nano-ini config.ini database | ConvertFrom-Json).host
- Export a section as environment variables
export $(nano-ini config.ini database | jq -r 'to_entries|.[]|"\(.key)=\(.value)"')
nano-ini config.ini database | jq -r 'to_entries|.[]|"\(.key)=\(.value)"' > .env
- Validate required keys
nano-ini config.ini database | jq -e 'has("host") and has("port")' >/dev/null && echo OK || echo MISSING
- Overlay/merge INIs (last wins)
cat base.ini override.ini | nano-ini - | jq .
- Use root (no section) keys
nano-ini config.ini "" | jq .
- GitHub Actions: output a field
echo "db_host=$(nano-ini config.ini database | jq -r .host)" >> "$GITHUB_OUTPUT"
- First N records
nano-csv2json data.csv | head -100 > sample.jsonl
Tip: Output is compact JSON. Combine with jq for querying, filtering, or formatting.
📜 License
MIT © 2025
Release files for nano-ini 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nano_ini-0.1.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nano_ini-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / nano_ini-0.1.0.tar.gz
| Download URL | nano_ini-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8edf269ed3ad4fce80f75a1451e914e624cdab644f9d07b3d9355d60c7b0bf32
|
|
BLAKE2b-256 checksum How to use checksums |
d578b3e754f0ca0834b0859a77fbc43259c675f2193c0a807fe61acc87410674
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / nano_ini-0.1.0-py3-none-any.whl
| Download URL | nano_ini-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e93c2b111f245d2f7d07e33f2102b0508153c24b64a2a495c3e1411d63472ac7
|
|
BLAKE2b-256 checksum How to use checksums |
0d7ae6182450cedd4dc55e7a3aa875f2f7f56117779753b07e3c57a57ac3552a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|