{ "info": { "author": "SawyerSteven", "author_email": "sawyerstevenk@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "\r\n.. image:: https://raw.githubusercontent.com/sawyersteven/SelfishClass/master/img/Logo_wide.png\r\n :target: https://raw.githubusercontent.com/sawyersteven/SelfishClass/master/img/Logo_wide.png\r\n :alt: Logo\r\n\r\n\r\nSelfishClass\r\n============\r\n\r\nSelfishClass is a minimal (~1kb) alternative to dataclasses and the popular `attrs `_ package for python.\r\n\r\nSelfishClass eliminates the need to assign variables as ``self.varname`` in a class's ``__init__`` method and provides a simple ``__repr__`` for the class instance.\r\n\r\nWhy not attrs?\r\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\r\n\r\nAttrs does a lot of things very well. SelfishClass does a few things very well. Rarely do I need all of Attr's functionality. Attrs weighs in at ~100kb. SelfishClass is less than 1kb. In the words of the great philosopher Kevin Malone, ``Me think, why waste time say lot word, when few word do trick.``\r\n\r\nWhy not dataclasses?\r\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\r\n\r\nDataclasses requires python 3.7, which may not be an option in some environments. Dataclasses require re-defining ``__init__`` methods as ``__post_init__``\\ , which can feel unintuitive and may require rewriting your classes. SelfishClass only requires that you insert the decorator.\r\n\r\nInstallation\r\n^^^^^^^^^^^^\r\n\r\nSelfishClass has been tested on Python 3.4.0 and 2.7.14 and is likely compatible with most other versions.\r\n\r\nInstall via pip with ``pip install SelfishClass``\r\n\r\nUsage\r\n^^^^^\r\n\r\nSelfishClass provides a simple class decorator that requires minimal or no change to your existing class definition.\r\n\r\n.. code-block::\r\n\r\n from SelfishClass import selfish\r\n\r\n @selfish\r\n class Teacher(object):\r\n def __init__(self, name, id, department=None):\r\n pass\r\n\r\n stan = Teacher('Stan', 445, department='Math')\r\n\r\n print(stan)\r\n >> Teacher: department: Math, id: 445, name: Stan\r\n\r\n\r\nAll vars are accessible in ``__init__`` as both instance variables and local variable. For instance, in ``__init__`` we can refer to ``name`` as both ``name`` and ``self.name``.\r\n\r\nYou may specify certain arguments to ignore if you do not want them to be assigned as instance vars. This is accomplished by using the decorator as such:\r\n\r\n.. code-block::\r\n\r\n # All positional args will be ignored by selfish\r\n @selfish(args=False)\r\n class Teacher(object):\r\n def __init__(self, name, id, department=None):\r\n pass\r\n\r\n # All kwargs will be ignored by selfish\r\n @selfish(kwargs=False)\r\n class Teacher(object):\r\n def __init__(self, name, id, department=None):\r\n pass\r\n\r\n # Only id will be ignored by selfish\r\n @selfish(ignore=['id'])\r\n class Teacher(object):\r\n def __init__(self, name, id, department=None):\r\n pass\r\n\r\n\r\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sawyersteven/SelfishClass", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "SelfishClass", "package_url": "https://pypi.org/project/SelfishClass/", "platform": "", "project_url": "https://pypi.org/project/SelfishClass/", "project_urls": { "Homepage": "https://github.com/sawyersteven/SelfishClass" }, "release_url": "https://pypi.org/project/SelfishClass/0.21/", "requires_dist": null, "requires_python": "", "summary": "A minimal alternative to dataclasses and python-attrs", "version": "0.21" }, "last_serial": 4123052, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "6cb1490dd7abd534ac90ac5d650ba177", "sha256": "ba332352f6c8e29c78c5ed0b72fd72e971fceb09a52dd0137a19bd77005eb272" }, "downloads": -1, "filename": "SelfishClass-0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "6cb1490dd7abd534ac90ac5d650ba177", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 2067, "upload_time": "2018-07-23T02:31:46", "url": "https://files.pythonhosted.org/packages/d4/3a/da39505818a9e1eb06495ead3b4864457092607c0bff47bb46c2ec9020fe/SelfishClass-0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87b3faa2656c129d6d9383c7533765fe", "sha256": "6ef7a113a72efb0db7e848d5d7f568963a27ac6f634b37c4510a08e68914f151" }, "downloads": -1, "filename": "SelfishClass-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "87b3faa2656c129d6d9383c7533765fe", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2074, "upload_time": "2018-07-23T02:31:47", "url": "https://files.pythonhosted.org/packages/c5/01/b373c65d93cee23b2c423b1c7adcde31fe1d28febe941dcc63af02792b07/SelfishClass-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0472c28ec1f4dd980d647327588f583", "sha256": "b66d5ee56f9b3e1742828d01455302d0d35e6d39c7d8672a50659c28d548f293" }, "downloads": -1, "filename": "SelfishClass-0.1.tar.gz", "has_sig": false, "md5_digest": "c0472c28ec1f4dd980d647327588f583", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2059, "upload_time": "2018-07-23T02:31:48", "url": "https://files.pythonhosted.org/packages/c6/af/f86396d80f91ef6d45e1d76fbc3695754e82ca76899e0dddba50eecfbffd/SelfishClass-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "dba98765ed77776fd739f6f3b3f9f5a7", "sha256": "8558ddd327ca4cb3970f616303e14dd821c17db3118cf660396bce88550c086d" }, "downloads": -1, "filename": "SelfishClass-0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "dba98765ed77776fd739f6f3b3f9f5a7", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 2222, "upload_time": "2018-07-24T01:44:54", "url": "https://files.pythonhosted.org/packages/40/a4/0db3d4c1d9022cb1736f7d6a1a8d590fff3554088915631dae7af624d5a7/SelfishClass-0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "088be2f2c3939f8230fd9839540b0be5", "sha256": "fad6ee291c5a7fbdf428a7ec96bc75bcb1226a5b7dba27970db9f6f243759ede" }, "downloads": -1, "filename": "SelfishClass-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "088be2f2c3939f8230fd9839540b0be5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2227, "upload_time": "2018-07-24T01:44:56", "url": "https://files.pythonhosted.org/packages/37/c6/621f8186bb76599af763ca3d28923a96db7700bdc0cfa5b87565ddbd04ce/SelfishClass-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cdb29748e614cdbc91386c45df573301", "sha256": "1f81fc98a6141329d4d2b567782731bc42831930183f6174e7699875f13dd327" }, "downloads": -1, "filename": "SelfishClass-0.2.tar.gz", "has_sig": false, "md5_digest": "cdb29748e614cdbc91386c45df573301", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2259, "upload_time": "2018-07-24T01:44:57", "url": "https://files.pythonhosted.org/packages/04/a6/dcfa033ebb562cb26952243f4b40038add837186edf848f6a64a64202bf0/SelfishClass-0.2.tar.gz" } ], "0.21": [ { "comment_text": "", "digests": { "md5": "ed63739db01353c8713cf9fd1c8979fc", "sha256": "aa76ad1383609e9c4128483a5cdf35e062c93c1de00bb9834e980c47bc83d686" }, "downloads": -1, "filename": "SelfishClass-0.21-py2-none-any.whl", "has_sig": false, "md5_digest": "ed63739db01353c8713cf9fd1c8979fc", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 2255, "upload_time": "2018-08-01T03:54:00", "url": "https://files.pythonhosted.org/packages/f7/31/fc7e124e3e224f89bb0f3c37549dfafd7f8ab566650ec49c3f6404133efa/SelfishClass-0.21-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d68c1b96dc4638355785714b84f39a57", "sha256": "4680a82d95a179ab3ba5d5f45df2c0e6798d4087d39b2b22239b3d7602816670" }, "downloads": -1, "filename": "SelfishClass-0.21-py3-none-any.whl", "has_sig": false, "md5_digest": "d68c1b96dc4638355785714b84f39a57", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2211, "upload_time": "2018-08-01T03:54:01", "url": "https://files.pythonhosted.org/packages/e1/86/23b498d187a84dff0ab73805146bc34e89312fce36ee4ea7bbfc1467d74e/SelfishClass-0.21-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8184e9d76a6b301bf7b3feebfecb58a8", "sha256": "6a26a16e7f6419bca304750fdea71ab825173b8841b49db7e42a8d0c026dadcf" }, "downloads": -1, "filename": "SelfishClass-0.21.tar.gz", "has_sig": false, "md5_digest": "8184e9d76a6b301bf7b3feebfecb58a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2267, "upload_time": "2018-08-01T03:54:02", "url": "https://files.pythonhosted.org/packages/3b/e1/6ee6262e28e117819995477d99c9707b3be2cd532454bf19e936eecd12ed/SelfishClass-0.21.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "6a5ed62a61c87c30fb1806af830f5d1f", "sha256": "85ce21f013e7a9af76b202a92d1a48bd1ed38a93f23a34f1e023178dedbe367c" }, "downloads": -1, "filename": "SelfishClass-0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "6a5ed62a61c87c30fb1806af830f5d1f", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 2246, "upload_time": "2018-08-01T03:54:34", "url": "https://files.pythonhosted.org/packages/83/c0/3615a2b39f3ff17dfe00f6cb2aec4a5cf7fea63f9d09c0339f065323e247/SelfishClass-0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "baf429f16d6a41541435de6b58856869", "sha256": "6fe3860293bd3bbe4c0ca224e5e0600e9c9d66a5d19bda9ada439fa2df44c572" }, "downloads": -1, "filename": "SelfishClass-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "baf429f16d6a41541435de6b58856869", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2200, "upload_time": "2018-08-01T03:54:35", "url": "https://files.pythonhosted.org/packages/41/40/3cad195591e96e025c69755a8459b45d4d192782b74fe76b8cae4f5da2a8/SelfishClass-0.3-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ed63739db01353c8713cf9fd1c8979fc", "sha256": "aa76ad1383609e9c4128483a5cdf35e062c93c1de00bb9834e980c47bc83d686" }, "downloads": -1, "filename": "SelfishClass-0.21-py2-none-any.whl", "has_sig": false, "md5_digest": "ed63739db01353c8713cf9fd1c8979fc", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 2255, "upload_time": "2018-08-01T03:54:00", "url": "https://files.pythonhosted.org/packages/f7/31/fc7e124e3e224f89bb0f3c37549dfafd7f8ab566650ec49c3f6404133efa/SelfishClass-0.21-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d68c1b96dc4638355785714b84f39a57", "sha256": "4680a82d95a179ab3ba5d5f45df2c0e6798d4087d39b2b22239b3d7602816670" }, "downloads": -1, "filename": "SelfishClass-0.21-py3-none-any.whl", "has_sig": false, "md5_digest": "d68c1b96dc4638355785714b84f39a57", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2211, "upload_time": "2018-08-01T03:54:01", "url": "https://files.pythonhosted.org/packages/e1/86/23b498d187a84dff0ab73805146bc34e89312fce36ee4ea7bbfc1467d74e/SelfishClass-0.21-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8184e9d76a6b301bf7b3feebfecb58a8", "sha256": "6a26a16e7f6419bca304750fdea71ab825173b8841b49db7e42a8d0c026dadcf" }, "downloads": -1, "filename": "SelfishClass-0.21.tar.gz", "has_sig": false, "md5_digest": "8184e9d76a6b301bf7b3feebfecb58a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2267, "upload_time": "2018-08-01T03:54:02", "url": "https://files.pythonhosted.org/packages/3b/e1/6ee6262e28e117819995477d99c9707b3be2cd532454bf19e936eecd12ed/SelfishClass-0.21.tar.gz" } ] }