{ "info": { "author": "Eerik Sven Puudist", "author_email": "eerik@herbfoods.eu", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# StrictParent\n\nPython is built to be as dynamic and permissive as possible. However, especially in case of larger applications it is beneficial to establish stricter principles. StrictParent helps you to make your Python classes more structured and enforcing contracts while still leaving the opportunity to break the rules if necessary.\n\nLight-weight and dependency free \u00f0\u0178\u02dc\u0160\n\n## Installation\n\n```sh\npip install strictparent\n```\n\nRequires Python 3.6+.\n\n## Features\n\n- `StrictParent` -- parent class for all your custom classes using these features\n- `@final` -- makes a method finalized, raises `InheritanceError` if subclasses try to override this method\n- `@overrides` -- decorator for methods, states that this subclass method is overriding a method in parent class. If parent class does not have such a method, raises an `InheritanceError`. Also, if a subclass is overriding a parent class method without making it explicit by using this decorator, an exception is risen.\n- `@force_override` -- decorator for overriding finalized parent class methods.\n\nAll the decorators can be used for inline classes as well.\n\nThe purpose of this approach is to make the code more understandable and to protect the developer against accidentally overriding a method, which served an important role in the parent class. However all methods can still be overridden if explicitly stated by `@force_override` decorator. This way we can write more readable code without loosing any freedom.\n\n`StrictParent` has no metaclass, so your do not have to face any trouble regarding metaclass conflicts.\n\n```py\nfrom strictparent import StrictParent, final, overrides\n\n\nclass Parent(StrictParent):\n\n def overrideable_method(self):\n return 'I do not mind being overridden'\n\n @final\n def final_method(self):\n return 'Knowledge & vision arose in me: this is the last birth. There is now no further becoming.'\n\n\nclass ObedientChild(Parent):\n\n @overrides # It is now easy to see, that the method has a meaning in the `Parent` class\n def overrideable_method(self):\n return 'Hey'\n\n @force_override # Finalized methods can be overridden if explicitly stated\n def final_method(self):\n return 'I am aware I have broken the convention'\n\n\nclass RebelChild(Parent):\n\n @overrides # Will raise an exception, because `Parent` class has no such method\n def my_heretic_method(self):\n return 'I claim to be be authentic, but I am just a faker'\n\n # Will raise an exception, because `@overrides` decorator is missing\n def overrideable_method(self):\n return 'I am hiding my lineage'\n\n # Will raise an exception, because `final_method` has been finalized in `Parent` class\n def final_method(self):\n return 'I am against the machine!'\n\n```\n\n### Using with built-in decorators\n\nYou can combine the custom decorators with the built-in `@classmethod`, `@staticmethod`, and `@property` decorators. The custom decorator must be the final wrapper, so add it to the top of all the other decorators:\n\n```py\n@final\n@overrides\n@classmethod\ndef overrideable_method(self):\n pass\n```\n\nPlease let us know if there are any other features that should be added to this package.\n\n## Contributing\n\nThere is no need for a virtual environment since you do not need to install any dependencies.\n\n### Running tests\n\nBeing in the root directory:\n\n```sh\ncd strictparent/\n./tests.py\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/eeriksp/StrictParent", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "strictparent", "package_url": "https://pypi.org/project/strictparent/", "platform": "", "project_url": "https://pypi.org/project/strictparent/", "project_urls": { "Homepage": "https://github.com/eeriksp/StrictParent" }, "release_url": "https://pypi.org/project/strictparent/3.3.2/", "requires_dist": null, "requires_python": ">=3.6", "summary": "@overrides and @final implementation for Python", "version": "3.3.2" }, "last_serial": 5152047, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "7287089505df25bd4ce1a21fa80b012e", "sha256": "332b06529bfe21310ceb580b6af779d40fde5a078aa7a02ab9e6a0ec47a8cf2a" }, "downloads": -1, "filename": "strictparent-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7287089505df25bd4ce1a21fa80b012e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5675, "upload_time": "2019-04-11T09:15:00", "url": "https://files.pythonhosted.org/packages/7f/4d/0a35689a21af63cef21b1bca371c4665b3308beb38d7b5c7e6dc0d5ef6cf/strictparent-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "71d8f607b33c13f64ccb9a155a8887bf", "sha256": "2056c26b270efab71c6052629743557aa40713e1b9376564c4e72bffa015217b" }, "downloads": -1, "filename": "strictparent-1.0.0.tar.gz", "has_sig": false, "md5_digest": "71d8f607b33c13f64ccb9a155a8887bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3902, "upload_time": "2019-04-11T09:15:03", "url": "https://files.pythonhosted.org/packages/82/03/53b54054d858532006d168c0c9c091ea9352dd059f294e27ed7b0b84d4ec/strictparent-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "a3bfaad115df7a58692342bac4549621", "sha256": "3c31e1cd00f8e4c0d89a9162f6545414466fce4af1fad01ecfce7706cfb99c7d" }, "downloads": -1, "filename": "strictparent-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a3bfaad115df7a58692342bac4549621", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5830, "upload_time": "2019-04-11T11:48:21", "url": "https://files.pythonhosted.org/packages/d2/8d/657098d9edb886fdc6d904c6bfb9b78c65673f849b93f1932c81d8e3a71f/strictparent-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4d4b83d1e93c390cabc666591ffe5e67", "sha256": "d5fdb6fcf8c5b5b54a19f8e5a57e64b0aefddcf688971c7957fa3bc320049cee" }, "downloads": -1, "filename": "strictparent-1.1.0.tar.gz", "has_sig": false, "md5_digest": "4d4b83d1e93c390cabc666591ffe5e67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4093, "upload_time": "2019-04-11T11:48:24", "url": "https://files.pythonhosted.org/packages/c4/68/60567369fabdcaa7b55cde80280d684ed0fbf4a4e6716ef9c9fd303fba7d/strictparent-1.1.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "99d14db0827ac40771ea9745c4d97aaf", "sha256": "b3b0afd7f2d7385ff0c4c1ecfa55c16ca925965debb9add8787dc22c9741f229" }, "downloads": -1, "filename": "strictparent-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "99d14db0827ac40771ea9745c4d97aaf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5672, "upload_time": "2019-04-11T18:45:26", "url": "https://files.pythonhosted.org/packages/21/a6/c6a9651716f89b42aeca3be888d90b580af174c47e8cdd3b6e395f649a20/strictparent-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a73cdefee759124c2e42a5d46067ecbb", "sha256": "3a8aa7f04af6f77d1e2ce1293035270a82d1affdea818eb4c169825e1c769a01" }, "downloads": -1, "filename": "strictparent-2.0.0.tar.gz", "has_sig": false, "md5_digest": "a73cdefee759124c2e42a5d46067ecbb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3948, "upload_time": "2019-04-11T18:45:28", "url": "https://files.pythonhosted.org/packages/b5/28/a62a13f9ac8103dbf9d03dcecb12c584713d80bfb717ff3dbd039f6bfa90/strictparent-2.0.0.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "cf02cf503c90e7ae8ba3cdc8d1cf56aa", "sha256": "e71e1af30e6cd49c45b76b2b74315f32d340581fff4dfdd85c37db51bad435a2" }, "downloads": -1, "filename": "strictparent-3.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "cf02cf503c90e7ae8ba3cdc8d1cf56aa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5988, "upload_time": "2019-04-13T14:04:58", "url": "https://files.pythonhosted.org/packages/c1/c7/b42188acc3ce40170a8fe05fe4b28fb3c3b8abaeec2a99ba291c727a7293/strictparent-3.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dfba2ff7b9c3530984d971a0fc746673", "sha256": "d2347fd42f30b20e14232e883bd359efb6d986787432bfd060c9f1aab2c7642b" }, "downloads": -1, "filename": "strictparent-3.0.0.tar.gz", "has_sig": false, "md5_digest": "dfba2ff7b9c3530984d971a0fc746673", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4291, "upload_time": "2019-04-13T14:05:02", "url": "https://files.pythonhosted.org/packages/e8/27/c3428ba622acb375150a9ab255ef920ce7ae24240c18e099b6674dc5eab6/strictparent-3.0.0.tar.gz" } ], "3.2.0": [ { "comment_text": "", "digests": { "md5": "b9a12a12ee1acb1b948f13925d92df80", "sha256": "fec92901c16c4e2874ab0af167a17d97442cfd9a1fcb8a4aba0a9f710a2a8dd4" }, "downloads": -1, "filename": "strictparent-3.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b9a12a12ee1acb1b948f13925d92df80", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 6191, "upload_time": "2019-04-13T19:21:09", "url": "https://files.pythonhosted.org/packages/93/ca/84ba5b6e8f47d2562007b83262649847d1001857e50753f889fbdf12e73f/strictparent-3.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a23721a41725049de9607b927f41609b", "sha256": "e5bc86b9821ed7beeee45c60a9573e326be5dc3ff8c60489823e529d6fc63a8a" }, "downloads": -1, "filename": "strictparent-3.2.0.tar.gz", "has_sig": false, "md5_digest": "a23721a41725049de9607b927f41609b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4496, "upload_time": "2019-04-13T19:21:10", "url": "https://files.pythonhosted.org/packages/06/9a/439b17f448f4fe83d96b3881b2c765a9c51eea0780c11dfd154e5ad76914/strictparent-3.2.0.tar.gz" } ], "3.3.0": [ { "comment_text": "", "digests": { "md5": "5b1b1370f4153dbbf75036296f27d587", "sha256": "86ae056f4baba9e39cb69ad29073160f439e45a2eee14b8093d4f24689860613" }, "downloads": -1, "filename": "strictparent-3.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5b1b1370f4153dbbf75036296f27d587", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 6265, "upload_time": "2019-04-15T11:46:56", "url": "https://files.pythonhosted.org/packages/16/3e/07b999f70eb771e3678e5ce3f0aec55cc34c2162e72d5b928bb6b7f97b66/strictparent-3.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ba8658241aec3face30a58772611e560", "sha256": "418a3a959e0978d062dc7a3599fa32f43e6388999fa715c43e0995853b8a7c4d" }, "downloads": -1, "filename": "strictparent-3.3.0.tar.gz", "has_sig": false, "md5_digest": "ba8658241aec3face30a58772611e560", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4551, "upload_time": "2019-04-15T11:46:58", "url": "https://files.pythonhosted.org/packages/2b/11/d0344428f260455ee8dc91f4bfc0d82589653f20e56bb941e0eb2f71cfff/strictparent-3.3.0.tar.gz" } ], "3.3.1": [ { "comment_text": "", "digests": { "md5": "d9654b96a6092ff5119a11c56f28316c", "sha256": "60e1cf9aa5aceb83efaa59b7411e4e61d767fd807d8d7939c327a8a287e43650" }, "downloads": -1, "filename": "strictparent-3.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d9654b96a6092ff5119a11c56f28316c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 6334, "upload_time": "2019-04-15T12:13:44", "url": "https://files.pythonhosted.org/packages/c3/50/525d0570932bd012a456f5e33a134a1e2f8f705bb704cb65b9276e38013f/strictparent-3.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2339c8590d4b7507e0499622ab36f60d", "sha256": "b27c1a349f98713cb0fad367a1bfcd0b4f6a73d09d21407c177ea0cc1f30ab40" }, "downloads": -1, "filename": "strictparent-3.3.1.tar.gz", "has_sig": false, "md5_digest": "2339c8590d4b7507e0499622ab36f60d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4621, "upload_time": "2019-04-15T12:13:47", "url": "https://files.pythonhosted.org/packages/8d/34/fd5c4b9c898b91ce32c633b0f05e135f0744562fbc84874de316283c9f11/strictparent-3.3.1.tar.gz" } ], "3.3.2": [ { "comment_text": "", "digests": { "md5": "d141bc30aaa2f66d784faa6ed484f32e", "sha256": "5bf842425c85dfdfc9eb0117e41ba11683a2ce59d7994e12a2ddf24d4ed6b96c" }, "downloads": -1, "filename": "strictparent-3.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d141bc30aaa2f66d784faa6ed484f32e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 6331, "upload_time": "2019-04-16T20:44:10", "url": "https://files.pythonhosted.org/packages/4b/43/ea67d6a2a44f56dc857c02343d1ce426e90e899a099b5876cd6e8838a739/strictparent-3.3.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64af27e28e23e95b942709d137f31206", "sha256": "c1b3bdfd329d155ee0cb824d65c41c0408e5f40cb357a30393a2349f35810ede" }, "downloads": -1, "filename": "strictparent-3.3.2.tar.gz", "has_sig": false, "md5_digest": "64af27e28e23e95b942709d137f31206", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4622, "upload_time": "2019-04-16T20:44:11", "url": "https://files.pythonhosted.org/packages/71/68/a4db89471baf4a9e897d407b9211deb393026673964482f4908e78df1332/strictparent-3.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d141bc30aaa2f66d784faa6ed484f32e", "sha256": "5bf842425c85dfdfc9eb0117e41ba11683a2ce59d7994e12a2ddf24d4ed6b96c" }, "downloads": -1, "filename": "strictparent-3.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d141bc30aaa2f66d784faa6ed484f32e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 6331, "upload_time": "2019-04-16T20:44:10", "url": "https://files.pythonhosted.org/packages/4b/43/ea67d6a2a44f56dc857c02343d1ce426e90e899a099b5876cd6e8838a739/strictparent-3.3.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64af27e28e23e95b942709d137f31206", "sha256": "c1b3bdfd329d155ee0cb824d65c41c0408e5f40cb357a30393a2349f35810ede" }, "downloads": -1, "filename": "strictparent-3.3.2.tar.gz", "has_sig": false, "md5_digest": "64af27e28e23e95b942709d137f31206", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4622, "upload_time": "2019-04-16T20:44:11", "url": "https://files.pythonhosted.org/packages/71/68/a4db89471baf4a9e897d407b9211deb393026673964482f4908e78df1332/strictparent-3.3.2.tar.gz" } ] }