larzyaml
A practical YAML subset — load and dump. Pure Python, zero dependencies.
Covers the YAML people actually write for config: nested mappings and sequences,
plain and quoted scalars with type inference, inline flow collections, and #
comments — the 95% that config files use, without a dependency.
from larzyaml import load, dump
load("""
name: myapp
port: 8080
debug: true
hosts:
- a.com
- b.com
db: {host: localhost, port: 5432}
""")
# {'name': 'myapp', 'port': 8080, 'debug': True,
# 'hosts': ['a.com', 'b.com'], 'db': {'host': 'localhost', 'port': 5432}}
Why
- No dependency.
PyYAMLpulls in a C extension (or a big pure-Python parser); larzyaml is a few hundred readable lines for the common cases. - The config subset, done right. Nested maps/sequences by indentation,
sequence-of-maps (
- key: value), typed scalars (1,2.5,true,null), inline[...]/{...}, and quote-aware comment stripping. - Round-trips.
dump()re-serializes, quoting ambiguous strings ("true","123") so they load back as strings.
Not the full spec — no anchors, tags, or block scalars. For config files, fixtures, and simple data, that's exactly enough. Pairs with larzconf.
Install
pip install larzyaml
Usage
from larzyaml import load, dump
data = load(open("config.yaml").read())
text = dump({"name": "app", "hosts": ["a", "b"], "db": {"port": 5432}})
Tests
python -m unittest discover -s tests -v # 18 tests incl. dump round-trips
The Larz stack
One of 30+ pure-Python, zero-dependency libraries at github.com/larz-scripter.
License
MIT © larz-scripter
Metadata
Release files for larzyaml 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 | Provenance | |
|---|---|---|---|---|
| larzyaml-0.1.0.tar.gz | 6.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| larzyaml-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.7 kB
Release files / larzyaml-0.1.0.tar.gz
| Download URL | larzyaml-0.1.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2660e4bab477ece78d312bc16400405e77d91e64cbc23151d3b90df9b5162af5
|
|
BLAKE2b-256 checksum How to use checksums |
68d0f57ce426187b661d55e5e8b4152516369c4e0bf9051241379c9a590aaf8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / larzyaml-0.1.0-py3-none-any.whl
| Download URL | larzyaml-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fdf4a7c00018fef78841fc1ff763e75088ee34d145f90e2e1c3caffce9846436
|
|
BLAKE2b-256 checksum How to use checksums |
cb64e0f205ceeae570b7005fd1843ec68283e576582f0a8ad0daeb403cfb640d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for larzyaml 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.