Skip to main content

databind.tagline

Databind is a library inspired by Jackson-databind to describe and bind data models for object-oriented programming. The databind.tagline module provides functionality to (de-) serialize strings of comma-separated key-value pairs.

Syntax

  • An object is defined of a comma-separated sequence of key-value pairs
  • An array is defined as a sequence of values
  • Key-value pairs or values can be grouped/nested with surrounding braces
  • Unions can be instantiated by prefixing a brace with the union member name
Notation Syntax JSON representation
Object a=b,c=d {"a": "b", "c": "d"}
Array a,b,c ["a", "b", "c"]
Union a{b=c} {"type": "a", "a": {"b": "c"}}
Nesting a={b=c} {"a": {"b": "c"}}
Nesting a,{b=c},d ["a", {"b": "c"}, "d"]

Quickstart

from databind.core import datamodel, field, uniontype
from databind.tagline import from_str

@datamodel
class BindMount:
  src: str
  dst: str
  read_only: bool = field(altname='readonly', default=False)

@uniontype({
  'bind': BindMount
} flat=False)
class Mount:
  pass

assert from_str(Mount, 'bind{src=data/,dst=/opt/data}') == BindMount('data/', '/opt/data')
assert from_str(Mount, 'type=bind,bind={src=data/,dst=/opt/data}') == BindMount('data/', '/opt/data')
assert from_str(BindMount, 'src=data/,dst=/opt/data,readonly=true') == BindMount('data/', '/opt/data')

Notes

  • All values are loaded as strings. It is up to the user of the load() function to interpret the values as needed. The dump() function converts numbers to string for convenience.
  • The union syntax is loaded into nested form, which requires that @uniontype() are configured with flat=False.
  • The actual data binding is out-sourced with the databind.json module (using a custom registry initialized with non-strict JSON converters, see databind.tagline:registry).
  • The loader/dumper does not currently support escaping control characters. Dumping a string that contains a control character (like { or ,) will result in output that cannot be parsed.

Copyright © 2020 Niklas Rosenstein

Metadata

Release files for databind.tagline 0.1.3

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

Source distribution (sdist)

Source distribution for databind.tagline 0.1.3
File Size Uploaded Provenance Actions
databind.tagline-0.1.3.tar.gz 5.6 kB Without provenance Details for databind.tagline-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for databind.tagline 0.1.3
File Interpreter ABI Platform Actions
databind.tagline-0.1.3-py3-none-any.whl Python 3 none any Details for databind.tagline-0.1.3-py3-none-any.whl

Total release size: 11.7 kB

Release files / databind.tagline-0.1.3.tar.gz

Download URL databind.tagline-0.1.3.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
991f17631401e09c281f2a8180fe030d11e5df90a83ba04602f8ac19d1f14319
BLAKE2b-256 checksum
How to use checksums
60735a1a185caa505ebe82d9dde8eca4ce57750bc9377fd661b97afbc8962e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Release files / databind.tagline-0.1.3-py3-none-any.whl

Download URL databind.tagline-0.1.3-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
602ae383b38e447f2a7a581d56084e2456f3fa0242932a7e40ffdf5608beb43a
BLAKE2b-256 checksum
How to use checksums
e8a429b59e4c2f6c193388c4ded0eca615b4b2c0f192e93d1cc39946944cb6c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Security for databind.tagline 0.1.3

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.

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