Skip to main content

snam

Still Not A Markup!

PyPI Build Coverage Status Documentation Downloads Downloads Downloads

Another YAML parser and builder featured by:

  • Include other files.
  • Expand environment varibales.
  • Execute and use the shell commands standard output.
  • Merge/Melt mappings.

Install

pip install snam

quickstart

from snam import loads

yamldoc = '''
foo:
  enabled: true
  title: BAR
  rate: .73
  user: !env USER
  greeting: !shell echo Hello

fruites:
  - cherry
  - melon
  - banana
  - pineapple
'''

obj = loads(ymldoc)
assert obj.foo.enabled
assert obj.title == 'BAR'
assert obj.rate == 0.73
assert obj.fruites == ['cherry', 'melon', 'banana', 'pineapple']

Tutorial

Parsing

You may user loads(str) function to parse YAML string, and load(file) to parse file-like object or filename. these functions return a snam.Meld object. The Meld object is subclass of the Python's dictionary but in addtion you can access the members by getattr, setattr and delattr operations.

meld = loads('foo: bar')
assert meld.foo == 'bar'
meld = load('foo.yml')
with open('foo.yml') as file:
  meld = load(file)

Merging/Melting

Using the |= operator you may merge any other dictionary or YAML-string into a Meld.

meld |= '''
  foo: bar
  baz: 23
'''

And also using the <<= you may load a file-like object or a filename into a Meld object.

meld <<= 'foo.yml'
with open('foo.yml') as file:
  meld <<= file

Dump

Use snam.dumps(obj) -> str, snam.dump(obj, file) and also meld >>= filename.

dumps(meld, indent=6, indentsize=2)
dump(meld, 'foo.yml', indent=6, indentsize=2)

with open('foo.yml', 'w') as file:
  dump(meld, file, indent=6, indentsize=2)
meld >>= 'foo.yml'
with open('foo.yml', 'w') as file:
  meld >>= file

Contribution

Dependencies

Install python-makelib.

Virtualenv

Create virtual environment:

make venv

Delete virtual environment:

make venv-delete

Activate the virtual environment:

source ./activate.sh

Install (editable mode)

Install this project as editable mode and all other development dependencies:

make env

Tests

Execute all tests:

make test

Execute specific test(s) using wildcard:

make test F=tests/test_db*
make test F=tests/test_form.py::test_querystringform

refer to pytest documentation for more info about invoking tests.

Execute tests and report coverage result:

make cover
make cover F=tests/test_static.py
make cover-html

Lint

make lint

Distribution

Execute these commands to create Python's standard distribution packages at dist directory:

make sdist
make wheel

Clean build directory

Execute:

make clean

to clean-up previous dist/* and build/* directories.

PyPI

WARNING: Do not do this if you'r not responsible as author and or maintainer of this project.

Execute

make clean
make pypi

to upload sdists and wheel packages on PyPI.

Documentation

source activate.sh
make doc
make doclive
make doctest

Or

source activate.sh
cd sphinx
make doctest
make html
make livehtml

Metadata

Release files for snam 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snam 1.2.0
File Size Uploaded Provenance
snam-1.2.0.tar.gz 11.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for snam 1.2.0
File Interpreter ABI Platform
snam-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / snam-1.2.0.tar.gz

Download URL snam-1.2.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8136e53e364859c3a561293f5b6e4fa64e516bee9200d741e20906eec6d9949e
BLAKE2b-256 checksum
How to use checksums
f7db7d09045152417af62a58efc3abc2338408f698dd1c01a49a798863ff23c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 13, 2026.

Transparency log

Release files / snam-1.2.0-py3-none-any.whl

Download URL snam-1.2.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64e11b883946954a512a6b76b7a13ecd23d5b05cb8e101cde7901e5a88d825c5
BLAKE2b-256 checksum
How to use checksums
0739596e4cc15e952449f035314a4a0243b4d70b5b2182c89f0164f772afbef0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 13, 2026.

Transparency log

Security for snam 1.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for snam-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 13, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page