Python serialization for adults
Project description
This fork from "eevee/camel" aims to maintain and potentially enhance the library, the original project has been inactive for years.
CamelX
CamelX is a library that lets you describe how to serialize your objects to YAML — and refuses to serialize them if you don't.
If you are interested in contributing, please submit pull requests.
Quick example:
from camelx 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file camelx-0.0.2.tar.gz.
File metadata
- Download URL: camelx-0.0.2.tar.gz
- Upload date:
- Size: 137.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f11f73e883645b03728d9a790d561defd8dd8441605c9a2eab8bf836f68ebea5
|
|
| MD5 |
1aa4f91050b0e943fc0ac8c6940dab6b
|
|
| BLAKE2b-256 |
d5eb50527d3c82b4a7f06ff63d6d8645a99ba8857bb1215e5a39ee7847936823
|
File details
Details for the file camelx-0.0.2-py3-none-any.whl.
File metadata
- Download URL: camelx-0.0.2-py3-none-any.whl
- Upload date:
- Size: 140.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a3d3966ab0c36ebd5b90febac7222b2ab8b794ad812364a887abbae0c785192
|
|
| MD5 |
78cf1d800ba053beec09425b5f7563e0
|
|
| BLAKE2b-256 |
0a8e7b03df1f35d383ad5058998ce262db772fa8d0b810a8249aa4271ae257ef
|