{ "info": { "author": "Tim Fischer", "author_email": "tim.fischer98@hotmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3" ], "description": "# PyCompose\n_A simple way to inject composition through inheritance syntax._\n\n## Inspirations\nThe following links served as inpiration during the writing of this, and as a in-depth explanation of what actually is composition and its benefits and drawbacks versus inheritance.\n* [Ariel Ortiz's 2019 PyCon talk](https://www.youtube.com/watch?v=YXiaWtc0cgE)\n* [forwardable](https://github.com/5long/forwardable)\n\n## Explanation\nFrom the inspirations one can easily see that an older implementation of compositional forwarding exists ([forwardable](https://github.com/5long/forwardable)) so why would I do this to myself? In short, I didn't like the syntax introduced by it. I find the syntax provided by this implementation a bit easier to understand as I find adding things that related to properties of a class inside the brackets in the class statement the most logical.\n\n## Usage\n```python\nfrom pycompose import Compose\n\n\nclass A:\n test1 = \"123\"\n\n def hello(self):\n print(\"A\")\n\n def __repr__(self):\n return \"\"\n\n\nclass B:\n test2 = \"456\"\n\n def hello(self):\n print(\"B\")\n\n def __repr__(self):\n return \"\"\n\n\nclass C(\n Compose(A, \"test1\", (\"hello\", \"helloA\")),\n Compose(B, \"test2\", (\"hello\", \"helloB\"), name=\"b_object\"),\n):\n ...\n\n\nc = C()\nprint(c.test1 + c.test2) # > 123456\nc.helloA() # > A\nc.helloB() # > B\nprint(c._a, c.b_object) # > \n```\n\n## Disclaimer\nPlease do note that this project is but a small abstraction for something that can easily be achieved only a few more lines of hand written code. As such I am aware of the fact that this may seem pretty useless to some people.\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/tim-fi/pycompose", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pycompose", "package_url": "https://pypi.org/project/pycompose/", "platform": "", "project_url": "https://pypi.org/project/pycompose/", "project_urls": { "Homepage": "https://github.com/tim-fi/pycompose" }, "release_url": "https://pypi.org/project/pycompose/1.1/", "requires_dist": null, "requires_python": "", "summary": "A simple way to inject composition through inheritance syntax.", "version": "1.1" }, "last_serial": 5411125, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "589a1f622ed18e96c23674f9452820a2", "sha256": "fc308db214dccaef6abfb374b728a583b4d1226359c6e2343193c6b48848a874" }, "downloads": -1, "filename": "pycompose-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "589a1f622ed18e96c23674f9452820a2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3772, "upload_time": "2019-06-12T07:32:03", "url": "https://files.pythonhosted.org/packages/1b/51/5402507df531dd4dc990af5d75155464f34cdab2086a52fcc6881e0ed8c4/pycompose-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "502562213774b0191bd641fdb55cec1b", "sha256": "0ded4deafc9eeb589bab33351fcde1a49abe2e02dbb74f21a87061d25756b4f6" }, "downloads": -1, "filename": "pycompose-1.0.tar.gz", "has_sig": false, "md5_digest": "502562213774b0191bd641fdb55cec1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2824, "upload_time": "2019-06-12T07:32:06", "url": "https://files.pythonhosted.org/packages/4c/77/50ccc3016145b406dbd29bf4969475e372a502d98dfe2f6fa295947557f0/pycompose-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "cd5f04091c0b05f9d204fbf1e4f70268", "sha256": "ed30c044c8fca6918354c0c9e1f2dd5df76bb0c945c1f9bf8f212515b0344ad9" }, "downloads": -1, "filename": "pycompose-1.1.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "cd5f04091c0b05f9d204fbf1e4f70268", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2634, "upload_time": "2019-06-17T17:53:10", "url": "https://files.pythonhosted.org/packages/2b/fa/fb7213c198b2fb4b1b7212cf5bea7638ef7373829533d2d3788644599add/pycompose-1.1.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "0d35db156f1ddd0f468d1bad55918011", "sha256": "8162facc077c1a19e6c68a8b8d3747a345f6c90ef4a633a43e43a5fc4d9f0b85" }, "downloads": -1, "filename": "pycompose-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0d35db156f1ddd0f468d1bad55918011", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3731, "upload_time": "2019-06-17T17:53:08", "url": "https://files.pythonhosted.org/packages/b1/3f/577dd994fb3cf67377c64d7805d51824c3b0383a2fd00f6cbb9347cb5285/pycompose-1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cd5f04091c0b05f9d204fbf1e4f70268", "sha256": "ed30c044c8fca6918354c0c9e1f2dd5df76bb0c945c1f9bf8f212515b0344ad9" }, "downloads": -1, "filename": "pycompose-1.1.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "cd5f04091c0b05f9d204fbf1e4f70268", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2634, "upload_time": "2019-06-17T17:53:10", "url": "https://files.pythonhosted.org/packages/2b/fa/fb7213c198b2fb4b1b7212cf5bea7638ef7373829533d2d3788644599add/pycompose-1.1.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "0d35db156f1ddd0f468d1bad55918011", "sha256": "8162facc077c1a19e6c68a8b8d3747a345f6c90ef4a633a43e43a5fc4d9f0b85" }, "downloads": -1, "filename": "pycompose-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0d35db156f1ddd0f468d1bad55918011", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3731, "upload_time": "2019-06-17T17:53:08", "url": "https://files.pythonhosted.org/packages/b1/3f/577dd994fb3cf67377c64d7805d51824c3b0383a2fd00f6cbb9347cb5285/pycompose-1.1-py3-none-any.whl" } ] }