serializable


Nameserializable JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/iskandr/serializable
SummaryBase class with serialization helpers for user-defined Python objects
upload_time2024-02-06 06:12:57
maintainer
docs_urlNone
authorAlex Rubinsteyn
requires_python
licensehttp://www.apache.org/licenses/LICENSE-2.0.html
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Tests](https://github.com/openvax/serializable/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/serializable/actions/workflows/tests.yml)
<a href="https://pypi.python.org/pypi/serializable/">
    <img src="https://img.shields.io/pypi/v/serializable.svg?maxAge=1000" alt="PyPI" />
</a>
# serializable

Base class with serialization methods for user-defined Python objects

## Usage

Classes which inherit from `Serializable` are enabled with default implementations of
`to_json`, `from_json`, `__reduce__` (for pickling), and other serialization
helpers.

A derived class must either:

- have a member data matching the name of each argument to `__init__`
- provide a user-defined `to_dict()` method which returns a dictionary whose keys match the arguments to `__init__`

If you change the keyword arguments to a class which derives from `Serializable` but would like to be able to deserialize older JSON representations then you can define a class-level dictionary called `_KEYWORD_ALIASES` which maps old keywords to new names (or `None` if a keyword was removed).

## Limitations

- Serializable objects must inherit from `Serializable`, be tuples or namedtuples, be serializble primitive types such as dict, list, int, float, or str.

- The serialized representation of objects relies on reserved keywords (such as `"__name__"`, and `"__class__"`), so dictionaries are expected to not contain any keys which begin with two underscores.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iskandr/serializable",
    "name": "serializable",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Alex Rubinsteyn",
    "author_email": "alex@openvax.org",
    "download_url": "https://files.pythonhosted.org/packages/0c/83/d5ea51d0d0538a9616824c22cafdf8dd543313ad48aed83bffa3ce74956c/serializable-0.4.0.tar.gz",
    "platform": null,
    "description": "[![Tests](https://github.com/openvax/serializable/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/serializable/actions/workflows/tests.yml)\n<a href=\"https://pypi.python.org/pypi/serializable/\">\n    <img src=\"https://img.shields.io/pypi/v/serializable.svg?maxAge=1000\" alt=\"PyPI\" />\n</a>\n# serializable\n\nBase class with serialization methods for user-defined Python objects\n\n## Usage\n\nClasses which inherit from `Serializable` are enabled with default implementations of\n`to_json`, `from_json`, `__reduce__` (for pickling), and other serialization\nhelpers.\n\nA derived class must either:\n\n- have a member data matching the name of each argument to `__init__`\n- provide a user-defined `to_dict()` method which returns a dictionary whose keys match the arguments to `__init__`\n\nIf you change the keyword arguments to a class which derives from `Serializable` but would like to be able to deserialize older JSON representations then you can define a class-level dictionary called `_KEYWORD_ALIASES` which maps old keywords to new names (or `None` if a keyword was removed).\n\n## Limitations\n\n- Serializable objects must inherit from `Serializable`, be tuples or namedtuples, be serializble primitive types such as dict, list, int, float, or str.\n\n- The serialized representation of objects relies on reserved keywords (such as `\"__name__\"`, and `\"__class__\"`), so dictionaries are expected to not contain any keys which begin with two underscores.\n",
    "bugtrack_url": null,
    "license": "http://www.apache.org/licenses/LICENSE-2.0.html",
    "summary": "Base class with serialization helpers for user-defined Python objects",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/iskandr/serializable"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee1dfc08c06ffde841414a02799d70ccee2c0f3cfed48ef1df3495b7889f7017",
                "md5": "eaa7f90a1d2afb185687bfc9ab31e11c",
                "sha256": "ce756a8e9a2e1ccee4c1ddbb4f33a677c4132c68220abd79ed7db4b56c9b787c"
            },
            "downloads": -1,
            "filename": "serializable-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eaa7f90a1d2afb185687bfc9ab31e11c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12912,
            "upload_time": "2024-02-06T06:12:56",
            "upload_time_iso_8601": "2024-02-06T06:12:56.802989Z",
            "url": "https://files.pythonhosted.org/packages/ee/1d/fc08c06ffde841414a02799d70ccee2c0f3cfed48ef1df3495b7889f7017/serializable-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c83d5ea51d0d0538a9616824c22cafdf8dd543313ad48aed83bffa3ce74956c",
                "md5": "2efece0b720571dabc4b5c9d55a23853",
                "sha256": "28987f54a381a994f59870a2010d083ab5e872f579cc09ca4a1fa562da32026d"
            },
            "downloads": -1,
            "filename": "serializable-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2efece0b720571dabc4b5c9d55a23853",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12827,
            "upload_time": "2024-02-06T06:12:57",
            "upload_time_iso_8601": "2024-02-06T06:12:57.930473Z",
            "url": "https://files.pythonhosted.org/packages/0c/83/d5ea51d0d0538a9616824c22cafdf8dd543313ad48aed83bffa3ce74956c/serializable-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-06 06:12:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iskandr",
    "github_project": "serializable",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "serializable"
}
        
Elapsed time: 0.41545s