Metadata-Version: 2.4
Name: larzyaml
Version: 0.1.0
Summary: A practical YAML subset (load + dump) in pure Python: nested maps/sequences, typed scalars, flow collections, comments. Zero dependencies.
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzyaml
Project-URL: Repository, https://github.com/larz-scripter/larzyaml
Project-URL: Issues, https://github.com/larz-scripter/larzyaml/issues
Keywords: yaml,yaml-parser,config,configuration,serialization,pyyaml-alternative,parser,zero-dependency
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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.

```python
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.** `PyYAML` pulls 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](https://github.com/larz-scripter/larzconf).

## Install

```bash
pip install larzyaml
```

## Usage

```python
from larzyaml import load, dump
data = load(open("config.yaml").read())
text = dump({"name": "app", "hosts": ["a", "b"], "db": {"port": 5432}})
```

## Tests

```bash
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](https://github.com/larz-scripter).

## License

MIT © larz-scripter
