Skip to main content

yamb

Build Status

YAml Meta Binding microframework

Define schema for YAML documents a-la SQLAlchemy to read, write and manipulate data like a python object.

Basic example

from yamb import Literal, Nested, Collection, YAMBObject


class Address(YAMBObject):
    city = Literal(default='New York')
    street = Literal()

class Person(YAMBObject):
    name = Literal()
    phone = Literal()
    address = Nested(Address)

    def lives_close_to(self, another_person):
        return self.address.city == another_person.address.city

class Phonebook(YAMBObject):
    title = Literal()
    people = Collection(Person)


friends = Phonebook(title='Friends', people=[])

friends.people.append(Person(name='Sue', phone='+12345', address=Address(street='Some blvd')))
sam = Person(name='Sam', phone='+123456', address=Address(city='London', street='Picadilly'))
friends.people += [sam]

with open('friends.yml', 'w') as f:
    f.write(friends._dump())

parsed = Phonebook._load(open('friends.yml'))

assert parsed.title == 'Friends'
assert parsed.people[0].address.city == 'New York'
assert parsed.people[1].name == 'Sam'

Metadata

Release files for yamb 0.1.2

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

Source distribution (sdist)

Source distribution for yamb 0.1.2
File Size Uploaded Provenance Actions
yamb-0.1.2.tar.gz 3.1 kB Without provenance Details for yamb-0.1.2.tar.gz

Release files / yamb-0.1.2.tar.gz

Download URL yamb-0.1.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5f6e6782739d1cb3468d432600023488b2633659a926807ce0ddc37068c5467a
BLAKE2b-256 checksum
How to use checksums
e3d4c872948ca3e2ef968a93b42c541f9121fcc9ebd629e6a38fdf6f35557e46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for yamb 0.1.2

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