Metadata-Version: 2.4
Name: dms-py
Version: 0.1.0
Summary: Pure-Python parser for DMS, a data syntax with strong typing, ordered maps, and heredocs.
Author: Filip Lopes
License: MIT OR Apache-2.0
Project-URL: Repository, https://gitlab.com/flo-labs/pub/dms-py
Keywords: dms,config,parser
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE-APACHE
License-File: LICENSE-MIT
Dynamic: license-file

<p align="center"><a href="https://gitlab.com/flo-labs/pub/dms"><img src="assets/logo.png" alt="DMS" width="120"></a></p>

# dms-py

Python implementations of **[DMS](https://gitlab.com/flo-labs/pub/dms)**, a data syntax with strong typing,
ordered maps, multi-line heredocs, and front-matter metadata.

Two packages live in this repo:

| dir       | PyPI name | description                                            |
| --------- | --------- | ------------------------------------------------------ |
| `dms/`    | `dms-py`  | pure-Python reference parser                           |
| `dms-c/`  | `dms-c`   | CPython extension wrapping the C parser (much faster)  |

The `dms-c` package compiles `external/dms-c/dms.c` (a git submodule). After
cloning, run:

```sh
git submodule update --init --recursive
```

## Install (pure Python)

```sh
pip install dms-py
```

```python
import dms_py

with open("config.dms") as f:
    doc = dms_py.parse(f.read())
```

## Install (C-extension)

```sh
pip install dms-c
```

```python
import dms_c

doc = dms_c.parse(open("config.dms").read())
```

Same API surface; the C variant is several times faster on wide-flat documents.

## Build & test (development)

```sh
python -m pip install -e .                  # pure-py, editable
python -m pip install -e ./dms-c             # C-ext, editable

python -m pytest tests/                      # round-trip + comment tests
```

## Conformance

The fixture corpus lives in [dms-tests](https://gitlab.com/flo-labs/pub/dms-tests)
(4500+ pairs). Clone it once as a sibling:

```sh
git clone https://gitlab.com/flo-labs/pub/dms-tests.git ../dms-tests
```

Then run the sweep:

```sh
python3 ../dms-tests/run_conformance.py "python3 encoder.py"
```

`dms-tests` can also drive every implementation in one shot — see its
README for the cross-language workflow.

## Publish

```sh
# pure Python
python -m build                              # creates dist/dms_py-0.1.0*
twine upload dist/dms_py-*

# C extension
cd dms-c && python -m build && twine upload dist/*
```

You'll need `pip install build twine` and a PyPI token configured (`~/.pypirc`).
The C-ext sdist must include `external/dms-c/dms.c` — either initialise the
submodule before `python -m build`, or use a build-time hook to copy the file.

## License

MIT OR Apache-2.0
