Skip to main content

Pure-Python parser for DMS, a data syntax with strong typing, ordered maps, and heredocs.

Project description

DMS

dms-py

Python implementations of 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:

git submodule update --init --recursive

Install (pure Python)

pip install dms-py
import dms_py

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

Install (C-extension)

pip install dms-c
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)

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 (4500+ pairs). Clone it once as a sibling:

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

Then run the sweep:

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

# 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dms_py-0.1.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dms_py-0.1.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file dms_py-0.1.0.tar.gz.

File metadata

  • Download URL: dms_py-0.1.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for dms_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9821d7689fd073d82f494c0e14731315c578381ab656753b75753bac4949cec
MD5 a03a47f62b997d7f34a7e8304dd0d2f8
BLAKE2b-256 4c2d016985c9417189c8c6d8b4c9af9aa0efa9a4b0bd2291018357f048f0862e

See more details on using hashes here.

File details

Details for the file dms_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dms_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for dms_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92271135e114bf9e725282b0d1392899ffffd34e4e2105ee652451793e873ac6
MD5 82990fd8bfff635b788db5688428195a
BLAKE2b-256 57b0e3d83534e67c0540b9601e24a6a3e74c642c571893908fc3391d8e1dc07c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page