{ "info": { "author": "Devin A. Conley", "author_email": "devinaconley@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# py-object-factory\n\n[![Build Status](https://travis-ci.org/devinaconley/py-object-factory.svg?branch=develop)](https://travis-ci.org/devinaconley/py-object-factory)\n[![codecov](https://codecov.io/gh/devinaconley/py-object-factory/branch/develop/graph/badge.svg)](https://codecov.io/gh/devinaconley/py-object-factory)\n\n**objectfactory** is a python package to easily implement the factory design pattern for object creation and serialization\n- serialization schema inherent in class definition\n- consistent interface to load many objects of arbitrary type\n- serialize object to human-readable JSON format\n\n## Example \nSimple **shapes** example:\n```python\nimport objectfactory\n\n@objectfactory.Factory.register_class\nclass Square( objectfactory.Serializable ):\n side = objectfactory.Field()\n\n def get_area( self ):\n return self.side * self.side\n\n@objectfactory.Factory.register_class\nclass Triangle( objectfactory.Serializable ):\n base = objectfactory.Field()\n height = objectfactory.Field()\n\n def get_area( self ):\n return 0.5 * self.base * self.height\n\nserialized_data = [\n {\"_type\": \"Square\", \"side\": 2.0},\n {\"_type\": \"Triangle\", \"base\": 1.75, \"height\": 2.50},\n {\"_type\": \"Square\", \"side\": 1.5},\n]\n\nfor data in serialized_data:\n shape = objectfactory.Factory.create_object( data )\n print( 'class type: {}, shape area: {}'.format( type( shape ), shape.get_area() ) )\n\n```\nOutput:\n```\nclass type: , shape area: 4.0\nclass type: , shape area: 2.1875\nclass type: , shape area: 2.25\n```\n\nSee more examples [here](examples)\n\n## Install\nUse [pip](https://pip.pypa.io/en/stable/installing/) for installation\n```\npip install objectfactory\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/devinaconley/py-object-factory", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "objectfactory", "package_url": "https://pypi.org/project/objectfactory/", "platform": "", "project_url": "https://pypi.org/project/objectfactory/", "project_urls": { "Homepage": "https://github.com/devinaconley/py-object-factory" }, "release_url": "https://pypi.org/project/objectfactory/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "A python package for the serializable model / factory pattern", "version": "0.0.2" }, "last_serial": 4969534, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "202f6405bc4131a63166f4d14bad645e", "sha256": "8790cd3cde835acb66bdf29530532a18e30704965a1dabf83de23d806d385e57" }, "downloads": -1, "filename": "objectfactory-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "202f6405bc4131a63166f4d14bad645e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7675, "upload_time": "2018-08-17T05:34:19", "url": "https://files.pythonhosted.org/packages/c8/19/806bb77ba0ab03b30219400d3a8e35b1ff9f9d6263e0113aa23274d768b1/objectfactory-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3085ec793e3b2af9925f38eb218de780", "sha256": "f65d3c70676ce3d944613a44ebf9bc935fbf31277d70fffa33ede1380bc7a3f1" }, "downloads": -1, "filename": "objectfactory-0.0.1.tar.gz", "has_sig": false, "md5_digest": "3085ec793e3b2af9925f38eb218de780", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4805, "upload_time": "2018-08-17T05:34:20", "url": "https://files.pythonhosted.org/packages/cc/07/68a2ea0a683a2e2f9bca29413c8f07f8c8a697f2408e4ac3b0699da63964/objectfactory-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "a4186747405700c00a73112567d49bbf", "sha256": "6b4137d2ca5cce9f433f4289afb460e622f86625a73e9410daa3e844ee2161ee" }, "downloads": -1, "filename": "objectfactory-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "a4186747405700c00a73112567d49bbf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10814, "upload_time": "2019-03-21T19:02:18", "url": "https://files.pythonhosted.org/packages/9a/ab/46485580e4d39da3dd7dec2ba9a3bd75a157861423883b0a3d4709dfeb20/objectfactory-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "456203d67a4e5e5051150dd3f84ef899", "sha256": "9e29184b35350668016c4632481f895869fbecb9748930022d6784f8f8a96ef6" }, "downloads": -1, "filename": "objectfactory-0.0.2.tar.gz", "has_sig": false, "md5_digest": "456203d67a4e5e5051150dd3f84ef899", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5800, "upload_time": "2019-03-21T19:02:19", "url": "https://files.pythonhosted.org/packages/fc/3c/ce46e6bdc21ca7ec437b34257741b7508e26a15f2d01aa384176160b832f/objectfactory-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a4186747405700c00a73112567d49bbf", "sha256": "6b4137d2ca5cce9f433f4289afb460e622f86625a73e9410daa3e844ee2161ee" }, "downloads": -1, "filename": "objectfactory-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "a4186747405700c00a73112567d49bbf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10814, "upload_time": "2019-03-21T19:02:18", "url": "https://files.pythonhosted.org/packages/9a/ab/46485580e4d39da3dd7dec2ba9a3bd75a157861423883b0a3d4709dfeb20/objectfactory-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "456203d67a4e5e5051150dd3f84ef899", "sha256": "9e29184b35350668016c4632481f895869fbecb9748930022d6784f8f8a96ef6" }, "downloads": -1, "filename": "objectfactory-0.0.2.tar.gz", "has_sig": false, "md5_digest": "456203d67a4e5e5051150dd3f84ef899", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5800, "upload_time": "2019-03-21T19:02:19", "url": "https://files.pythonhosted.org/packages/fc/3c/ce46e6bdc21ca7ec437b34257741b7508e26a15f2d01aa384176160b832f/objectfactory-0.0.2.tar.gz" } ] }