{ "info": { "author": "Balanced", "author_email": "dev@balancedpayments.com", "bugtrack_url": null, "classifiers": [], "description": "# PEZ - Python P(r)e-(Seriali)z(ation)\n\nA python library for serializing python objects from their internal\nrepresentation to something that can be displayed externally. e.g. This will\ntransform a python object into a dictionary.\n\nThis can include mapping field names, transforming, and selectively displaying\ndata.\n\n[![Build Status](https://secure.travis-ci.org/balanced/pez.png?branch=master)](http://travis-ci.org/balanced/pez)\n\n## Installation\n\n pip install pez\n\n## Example\n\n import pez\n import json\n\n # Your internal object e.g. a model\n class Internal(object):\n field1 = 123\n\n field2 = 1\n field3 = 2\n\n # How you want to expose the model to the world\n class InternalView(pez.FieldMapping):\n # pez.Field echos the object as it is.\n field1 = pez.Field()\n\n # A static method such as this can allow you to customize the data\n # returned.\n @staticmethod\n def calculated_field(ctx, o):\n return o.field2 + o.field3\n\n\n # create an instance of the serialize and map views to models via the\n # register method\n pre_serialize = pez.Serializer()\n pre_serialize.register(Internal, InternalView())\n\n # calling our serializer with an instance of a class will return a\n # serializable object (e.g. a dictionary)\n pre_serialize(Internal())\n\n\nSee `./examples/` for more examples including how to use with an ORM, how to\nuse with Flask, and other more advanced use cases.\n\n\n## Why\n\nPEZ allows you to separate the internal representation of data from your\nexternal view. This is handy for all sorts of scenarios:\n\n* Renaming internal fields without breaking external interfaces\n* Hiding or transforming internal data when exposing it\n* Adding information to views that doesn't belong in your data models, e.g. URL information\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Write your code **and unit tests**\n4. Ensure all tests still pass (`nosetests`)\n5. [PEP8](http://pypi.python.org/pypi/pep8) your code\n6. Commit your changes (`git commit -am 'Add some feature'`)\n7. Push to the branch (`git push origin my-new-feature`)\n8. Create new pull request", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/balanced/pez", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pez", "package_url": "https://pypi.org/project/pez/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pez/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/balanced/pez" }, "release_url": "https://pypi.org/project/pez/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "PEZ - Python P(r)e-(Seriali)z(ation)", "version": "0.0.2" }, "last_serial": 796186, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "88774b63f054f40cffab81b4bf617825", "sha256": "fe02f6f471600bc1b904d073528b936f457571e99a4822360d1ac0cf2bd64544" }, "downloads": -1, "filename": "pez-0.0.1.tar.gz", "has_sig": false, "md5_digest": "88774b63f054f40cffab81b4bf617825", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8847, "upload_time": "2013-02-27T17:40:14", "url": "https://files.pythonhosted.org/packages/78/b1/c6f1a0cf63ec7923cafd4d564c16a86cf37bd112e607a5bbe858561bbd43/pez-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "9353d491f008f8d9cf90837301df9e5e", "sha256": "f96fa3fa7d4dbbd7c5debe22ed1518f1c082b4a5853c200a4179dda4fc87c463" }, "downloads": -1, "filename": "pez-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9353d491f008f8d9cf90837301df9e5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9209, "upload_time": "2013-02-27T17:41:18", "url": "https://files.pythonhosted.org/packages/9b/5b/94b570590b89c5e15ecf5623863c31838d2b0794a4d3a11ac54996453ba6/pez-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9353d491f008f8d9cf90837301df9e5e", "sha256": "f96fa3fa7d4dbbd7c5debe22ed1518f1c082b4a5853c200a4179dda4fc87c463" }, "downloads": -1, "filename": "pez-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9353d491f008f8d9cf90837301df9e5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9209, "upload_time": "2013-02-27T17:41:18", "url": "https://files.pythonhosted.org/packages/9b/5b/94b570590b89c5e15ecf5623863c31838d2b0794a4d3a11ac54996453ba6/pez-0.0.2.tar.gz" } ] }