This release is a pre-release and may not be stable for production use.
Stringly: Human Readable Object Serialization
Stringly aims to facilitate foreign function calls into Python by providing human readable serialization and de-serialization of arbitrary Python objects.
Stringly is similar to Python's pickle protocol in that the serialized form follows directly from class introspection. This as opposed to serialization technologies such as JSON and YAML, which are self contained but support only a predefined set of data types. Similar to those technologies, however, and unlike pickle, the resulting strings are human readible and human writable.
A typical use case of stringly is as part of a command line parser, using the stringly representation to instantiate objects direcly from the command line.
Example
Stringly requires type hints to infer object types. Since these are getting more and more common, chances are that stringly will work directly out of the box. In case extra work is required, the reward is double as this effort should also benefit static type checkers such as mypy.
The following is an example of a class that is suitable for stringlification:
>>> import typing, dataclasses, stringly
>>>
>>> @dataclasses.dataclass
... class A:
... name: str
... data: typing.Dict[str,int]
Objects are serialized using stringly.dumps:
>>> a = A('hi', {'foo': 1, 'bar': 2})
>>> stringly.dumps(A, a)
# 'name=hi,data={foo=1,bar=2}'
Objects are de-serialized using stringly.loads:
>>> a = stringly.loads(A, 'name=bye,data={baz=3}')
>>> a.name
# 'bye'
>>> a.data
# {'baz': 3}
Release files for stringly 1.0b3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stringly-1.0b3.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stringly-1.0b3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.2 kB
Release files / stringly-1.0b3.tar.gz
| Download URL | stringly-1.0b3.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77c37d2ee075a03e7336d620ac658830956a14329da808540393daec62db3b71
|
|
BLAKE2b-256 checksum How to use checksums |
ac8e59630fee909c40c5887a6c94d22c5d5b0170dd7bba1ef4930fc2f0aa9fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / stringly-1.0b3-py3-none-any.whl
| Download URL | stringly-1.0b3-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
175cf9676bffb642b78e1514b5f8b88d7860d2dd3923ca21fc8f8d11c334cd71
|
|
BLAKE2b-256 checksum How to use checksums |
264d911eefbf82211598679c7ff849b7416ac43a7d48a82fb35e0affa3d5dc7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|