Skip to main content

Camel is a library that lets you describe how to serialize your objects to YAML — and refuses to serialize them if you don’t.

Quick example:

from camel import Camel, CamelRegistry

class DieRoll(tuple):
    def __new__(cls, a, b):
        return tuple.__new__(cls, [a, b])

    def __repr__(self):
        return "DieRoll(%s,%s)" % self

reg = CamelRegistry()

@reg.dumper(DieRoll, u'roll', version=None)
def _dump_dice(data):
    return u"{}d{}".format(*data)

@reg.loader(u'roll', version=None)
def _load_dice(data, version):
    a, _, b = data.partition(u'd')
    return DieRoll(int(a), int(b))

value = DieRoll(3, 6)
camel = Camel([reg])
print(camel.dump(value))

# !roll 3d6
# ...

Docs: http://camel.readthedocs.org/en/latest/

GitHub: https://github.com/eevee/camel

Metadata

Release files for camel 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 camel 0.1.2
File Size Uploaded
camel-0.1.2.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for camel 0.1.2
File Interpreter ABI Platform
camel-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 31.0 kB

Release files / camel-0.1.2.tar.gz

Download URL camel-0.1.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f61080abbdd68ad40bfe4ecaee9ea34ff07344ad98d1f2041f0ccccbcf42f271
BLAKE2b-256 checksum
How to use checksums
9b3a6f52fe0ab7a02a9765e5fc79beaaa9b271fee29d483df150feb548774882
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / camel-0.1.2-py2.py3-none-any.whl

Download URL camel-0.1.2-py2.py3-none-any.whl
Size 23.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a297440c3f2c41603bad63275e33f26f972329a501a7cb80e6e4934403ccf988
BLAKE2b-256 checksum
How to use checksums
53eba2dac5267704c2d83f7a3ebd033605b593270c500f7407e84fdc89b7452d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1

2 release files

0.0.0

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