{ "info": { "author": "Younes JAAIDI", "author_email": "yjaaidi@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: Software Development :: Code Generators", "Topic :: Utilities" ], "description": "Be synthetic with PySynthetic\n#############################\n\n**PySynthetic** is a set of tools that aims to make writing Python classes shorter and \"cleaner\".\n\nFor instance, one can add properties and accessors *(getters/setters)* to a class with only one line of code *(using respectively* ``synthesize_property`` *and* ``synthesize_member`` *decorators)*, thus making the code more than 5 times shorter *(see* `examples`_ *)*. One can even avoid the laborious task of members initialization by using the ``synthesize_constructor`` decorator that takes care of writing the ``__init__`` method.\n\n**PySynthetic** is also useful for applying strict type checking with no pain just by using the decorators' ``contract`` argument *(see* `PyContracts `_ *)*.\n\nHelp and ideas are appreciated! Thank you!\n\n.. image:: https://api.flattr.com/button/flattr-badge-large.png\n :target: https://flattr.com/thing/1167227/\n\n.. image:: https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif\n :target: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=yjaaidi%40gmail%2ecom&lc=US&item_name=yjaaidi¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted\n\nResources\n*********\n\n* `Documentation `_\n* `Bug Tracker `_\n* `Code `_\n* `Mailing List `_ \n\nInstallation\n************\n\n.. code-block:: shell\n\n pip install pysynthetic\n\nOr simply from the tarball or source code if you are not using *pip*.\n\n.. code-block:: shell\n\n python setup.py install\n\nExamples\n********\n\nSynthetic properties\n====================\n\nWith **PySynthetic**, the following code *(8 lines)*...\n\n.. code-block:: python\n\n from synthetic import synthesize_constructor, synthesize_property\n \n @synthesize_property('a', contract = int)\n @synthesize_property('b', contract = list)\n @synthesize_property('c', default = \"\", contract = str, read_only = True)\n @synthesize_constructor()\n class ShortAndClean(object):\n pass\n\n... replaces this *(43 lines)*:\n\n.. code-block:: python\n\n from contracts import contract\n \n class ThisHurtsMyKeyboard(object):\n \n @contract\n def __init__(self, a, b, c = \"\"):\n \"\"\"\n :type a: int\n :type b: list\n :type c: str\n \"\"\"\n self._a = a\n self._b = b\n self._c = c\n \n @property\n def a(self):\n return self._a\n \n @a.setter\n @contract\n def a(self, value):\n \"\"\"\n :type value: int\n \"\"\"\n self._a = value\n \n @property\n def b(self):\n return self._b\n \n @b.setter\n @contract\n def b(self, value):\n \"\"\"\n :type value: list\n \"\"\"\n self._b = value\n \n @property \n def c(self):\n return self._c\n\nSynthetic accessors\n===================\n\nBut, if you are more into accessors than properties, you can use ``synthesize_member`` decorator instead.\n\nThis way, the following code *(8 lines)*...\n\n.. code-block:: python\n\n from synthetic import synthesize_constructor, synthesize_member\n \n @synthesize_member('a', contract = int)\n @synthesize_member('b', contract = list)\n @synthesize_member('c', default = \"\", contract = str, read_only = True)\n @synthesize_constructor()\n class ShortAndClean(object):\n pass\n\n...will replace this *(37 lines)*:\n\n.. code-block:: python\n\n from contracts import contract\n \n class ThisHurtsMyKeyboard(object):\n \n @contract\n def __init__(self, a, b, c = \"\"):\n \"\"\"\n :type a: int\n :type b: list\n :type c: str\n \"\"\"\n self._a = a\n self._b = b\n self._c = c\n \n def a(self):\n return self._a\n \n @contract\n def set_a(self, value):\n \"\"\"\n :type value: int\n \"\"\"\n self._a = value\n \n def b(self):\n return self._b\n \n @contract\n def set_b(self, value):\n \"\"\"\n :type value: list\n \"\"\"\n self._b = value\n \n def c(self):\n return self._c\n\n", "description_content_type": null, "docs_url": null, "download_url": "https://pypi.python.org/pypi/pysynthetic/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yjaaidi/pysynthetic", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pysynthetic", "package_url": "https://pypi.org/project/pysynthetic/", "platform": "any", "project_url": "https://pypi.org/project/pysynthetic/", "project_urls": { "Download": "https://pypi.python.org/pypi/pysynthetic/", "Homepage": "https://github.com/yjaaidi/pysynthetic" }, "release_url": "https://pypi.org/project/pysynthetic/0.5.2/", "requires_dist": null, "requires_python": "", "summary": "Easy Python class writing and type checking", "version": "0.5.2" }, "last_serial": 2814490, "releases": { "0.4.10": [ { "comment_text": "", "digests": { "md5": "6435045e7ccf834a1cdf15cc1f865ba0", "sha256": "ed4acbcaa98145b9e51b34a2b240db4fd9b5dfd150f639cfe1022001051e4c9a" }, "downloads": -1, "filename": "pysynthetic-0.4.10.tar.gz", "has_sig": false, "md5_digest": "6435045e7ccf834a1cdf15cc1f865ba0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151553, "upload_time": "2013-04-11T23:27:40", "url": "https://files.pythonhosted.org/packages/cd/6b/80a3a2d4605608b5a669c18ff3a50b45c1820fa1957b7eb0b96579f8f81b/pysynthetic-0.4.10.tar.gz" } ], "0.4.11": [ { "comment_text": "", "digests": { "md5": "e8d51be37cdc5ee4b3dbec6397b69a81", "sha256": "b864564061dea75af69b2db2f2b582181e6f4b2c9810235f9e6776d7a3e01387" }, "downloads": -1, "filename": "pysynthetic-0.4.11.tar.gz", "has_sig": false, "md5_digest": "e8d51be37cdc5ee4b3dbec6397b69a81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 148350, "upload_time": "2015-01-31T20:43:36", "url": "https://files.pythonhosted.org/packages/fd/d6/c864d0275ff178ee3af3df48f80ffbdc1f49fdf325ba4c720331053db85f/pysynthetic-0.4.11.tar.gz" } ], "0.4.12": [ { "comment_text": "", "digests": { "md5": "75bb937634b7523d7195307eb459b53c", "sha256": "bf150c1439833eeca0b108f12e7d1d3240d217875129198149a01f9ae8ab8290" }, "downloads": -1, "filename": "pysynthetic-0.4.12.tar.gz", "has_sig": false, "md5_digest": "75bb937634b7523d7195307eb459b53c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 148330, "upload_time": "2015-11-16T16:03:36", "url": "https://files.pythonhosted.org/packages/ef/0b/22b46e16ae506f107057f9c7e1ff6be55a09fefd878e94d2bed135eb8e35/pysynthetic-0.4.12.tar.gz" } ], "0.4.13": [ { "comment_text": "", "digests": { "md5": "5a7160b7d5ab1215373d29ada652de93", "sha256": "6a6a5a7ccf17513769bab4af9f5129e3f9d9065406ed9391a9de5f8af159bb57" }, "downloads": -1, "filename": "pysynthetic-0.4.13.tar.gz", "has_sig": false, "md5_digest": "5a7160b7d5ab1215373d29ada652de93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 148336, "upload_time": "2015-11-16T18:10:43", "url": "https://files.pythonhosted.org/packages/c5/2e/95bbca84415eb71be643c90c24a6b2e690f857fbafa7960eb602124efeea/pysynthetic-0.4.13.tar.gz" } ], "0.4.14": [ { "comment_text": "", "digests": { "md5": "dd5330bd649037d8cdf25909411f2eac", "sha256": "52d1c4a51ab18b2c47e2b3dd797957fff01af78853c333dd67f8045e2d754f8f" }, "downloads": -1, "filename": "pysynthetic-0.4.14.tar.gz", "has_sig": false, "md5_digest": "dd5330bd649037d8cdf25909411f2eac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 148503, "upload_time": "2016-03-17T23:05:18", "url": "https://files.pythonhosted.org/packages/aa/40/a6d559eeced08d90671225da041209209901fcd287ee98e29bd44221aa71/pysynthetic-0.4.14.tar.gz" } ], "0.4.8": [ { "comment_text": "", "digests": { "md5": "826f1e419a41edac9ae842c625df1259", "sha256": "4a7242fa4d406c918cbcdb48c67a770cc12a43938c2778ce35593b1323db896c" }, "downloads": -1, "filename": "pysynthetic-0.4.8.tar.gz", "has_sig": false, "md5_digest": "826f1e419a41edac9ae842c625df1259", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 147876, "upload_time": "2013-03-09T23:16:57", "url": "https://files.pythonhosted.org/packages/85/01/f838b7070c18978a9898475b57b0229d66a359e48959ab6ebf61584d6d66/pysynthetic-0.4.8.tar.gz" } ], "0.4.9": [ { "comment_text": "", "digests": { "md5": "63993d69cad7bb3f29d146d7c98f8dcd", "sha256": "125d5eb6befaeaa8aac37fde3f2287de9d3203ad20de67105922acb09c6bf3cb" }, "downloads": -1, "filename": "pysynthetic-0.4.9.tar.gz", "has_sig": false, "md5_digest": "63993d69cad7bb3f29d146d7c98f8dcd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151710, "upload_time": "2013-03-10T23:25:32", "url": "https://files.pythonhosted.org/packages/e6/17/d5a71b0208ff70a95eb3cadb0f426a2d2d28711459d78db849e259aa6781/pysynthetic-0.4.9.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "ba67851e04083d57a94473dabeaf8499", "sha256": "1392d77c5d1a7fce1071f12f1955ee1f235413af64f237d100fb7bbc080d07da" }, "downloads": -1, "filename": "pysynthetic-0.5.0.tar.gz", "has_sig": false, "md5_digest": "ba67851e04083d57a94473dabeaf8499", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 150264, "upload_time": "2016-11-02T09:55:12", "url": "https://files.pythonhosted.org/packages/7c/19/39af5a34f322f43469572f26c0234c96c6de2df1e794077e499ed2907832/pysynthetic-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "0c62ae3de0f37f958f40d773b098848e", "sha256": "c6d668ffef9074b25c618b0e1786e7b46542b54f3897b0af35137dab63a54807" }, "downloads": -1, "filename": "pysynthetic-0.5.1.tar.gz", "has_sig": false, "md5_digest": "0c62ae3de0f37f958f40d773b098848e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 150274, "upload_time": "2016-12-14T11:25:06", "url": "https://files.pythonhosted.org/packages/1a/b1/eae5d8a0aabd6209d36a600c1ac2a8f2beae58f8cbaa7102002721c8e4ea/pysynthetic-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "f31bea019791a2ceef8cf025bc08fa62", "sha256": "919635566e58a94f1e60e553aaa610a55b3e55d9abaddbf96f6d49bd667989a1" }, "downloads": -1, "filename": "pysynthetic-0.5.2.tar.gz", "has_sig": false, "md5_digest": "f31bea019791a2ceef8cf025bc08fa62", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 150347, "upload_time": "2017-04-19T16:14:13", "url": "https://files.pythonhosted.org/packages/11/33/5891af4d9b4794319c33e37552807446e06a790cd2d75f6e15073c3e2e99/pysynthetic-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f31bea019791a2ceef8cf025bc08fa62", "sha256": "919635566e58a94f1e60e553aaa610a55b3e55d9abaddbf96f6d49bd667989a1" }, "downloads": -1, "filename": "pysynthetic-0.5.2.tar.gz", "has_sig": false, "md5_digest": "f31bea019791a2ceef8cf025bc08fa62", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 150347, "upload_time": "2017-04-19T16:14:13", "url": "https://files.pythonhosted.org/packages/11/33/5891af4d9b4794319c33e37552807446e06a790cd2d75f6e15073c3e2e99/pysynthetic-0.5.2.tar.gz" } ] }