{ "info": { "author": "Nicholas Morley", "author_email": "nick.morley111@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# PyID\n[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)\n\nTurn any python object into an exactly equivalent object with an `id` attribute.\n\n## Example\n\n```python\nimport random\nimport pyid\n\n\nmylist = [random.sample(range(10), k=3) for i in range(20)]\n\n\n# Uses python uuid module to assign ID by default\nmylist = [pyid.idfy(item) for item in mylist]\nfor item in mylist:\n print(item, item.id)\n\n\n# Assign a custom ID\nmylist = [pyid.idfy(item, 'myid') for item in mylist]\nfor item in mylist:\n print(item, item.id)\n```\n\n## Installation\n\n```bash\npip install pyid\n```\n\n## Motivation\n\nWhen referencing related objects, we use unique IDs. In python, we might handle this pattern with a dictionary mapping IDs to objects, or use an item's position in a list as its ID. Either case requires we create variables separate from the object to represent those IDs, and that each time we iterate we explicitly include the ID by iterating with the ID dict or the enumerate function for lists. I built this to test the idea that having an ID attribute is easier and cleaner.\n\n## How it works\n\nIt takes the `type` of the passed object, creates a subclass of that type, with an ID attribute, and copies the data from the passed object into an instance that new subclass. If a custom ID is not passed, the python uuid module is used to assign one.\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/cyclecycle/pyid", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyid", "package_url": "https://pypi.org/project/pyid/", "platform": "", "project_url": "https://pypi.org/project/pyid/", "project_urls": { "Homepage": "https://github.com/cyclecycle/pyid" }, "release_url": "https://pypi.org/project/pyid/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "ID attributes for python objects", "version": "0.0.3" }, "last_serial": 5551153, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2499051b88d94a6d593cf75fff9aff18", "sha256": "217336b65c4e4c52a1c31fe4eef2b0f315ecc78d649bf77717a9ebe966af0706" }, "downloads": -1, "filename": "pyid-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2499051b88d94a6d593cf75fff9aff18", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1720, "upload_time": "2019-07-18T10:20:57", "url": "https://files.pythonhosted.org/packages/50/df/1fa03d50465e32a9c3fb74424de39171347e120b1359d58dc66694952dd5/pyid-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "36917adc2f37b8524fab8f4ea1b2bb9c", "sha256": "1c3c904e44c19ad1e47719c013a5619e8bf3268e5850f7f2fb750a4921fbaf73" }, "downloads": -1, "filename": "pyid-0.0.1.tar.gz", "has_sig": false, "md5_digest": "36917adc2f37b8524fab8f4ea1b2bb9c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1641, "upload_time": "2019-07-18T10:21:01", "url": "https://files.pythonhosted.org/packages/b0/97/2289b98f1044b719c1896310690f9f11875f0482d4b9eca005f59353205e/pyid-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "5bba62a9693689374fccfc4b1da5207c", "sha256": "aabc42689301603bd8cb97f8364ef39fc8da0957c01b60c7e5286009b24c7d70" }, "downloads": -1, "filename": "pyid-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5bba62a9693689374fccfc4b1da5207c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1794, "upload_time": "2019-07-18T11:12:51", "url": "https://files.pythonhosted.org/packages/09/65/5cf469d71cca17a0c54275c98cda9e8c7106a675a727d439bf045581d8aa/pyid-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a0ba447d33c9bdfdc8058cb238400f09", "sha256": "9bd336a77ac196e1d70495945a3f47a3ede40d452488c8fdf84d7e822ddf3fc7" }, "downloads": -1, "filename": "pyid-0.0.2.tar.gz", "has_sig": false, "md5_digest": "a0ba447d33c9bdfdc8058cb238400f09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1718, "upload_time": "2019-07-18T11:12:52", "url": "https://files.pythonhosted.org/packages/a7/25/f390de70148a3bccf59a73066c86647ea8217fadea448c7cae56d45e260a/pyid-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "120c57bf5ea16671fd8524bc645188d4", "sha256": "77a233f363ff81ae80ba113396b6c28dca1fb8cd2ccabcb87b1e052575a10e41" }, "downloads": -1, "filename": "pyid-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "120c57bf5ea16671fd8524bc645188d4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2279, "upload_time": "2019-07-18T13:18:46", "url": "https://files.pythonhosted.org/packages/31/0d/ab8f774b0570d0b07361e50c89e04589bce20661b8ac9680decbe68a3545/pyid-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2df7b0a5d2b8493f4a9a99a0c2cc66f", "sha256": "91846651d747a8759cea474bc21764a318a4743a6fec32807a6d510f7cbd7cd5" }, "downloads": -1, "filename": "pyid-0.0.3.tar.gz", "has_sig": false, "md5_digest": "e2df7b0a5d2b8493f4a9a99a0c2cc66f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1958, "upload_time": "2019-07-18T13:18:47", "url": "https://files.pythonhosted.org/packages/f5/6b/b44d784600a75ff916bad5af7c528673135b0e02af1e4b71a83ee5a67438/pyid-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "120c57bf5ea16671fd8524bc645188d4", "sha256": "77a233f363ff81ae80ba113396b6c28dca1fb8cd2ccabcb87b1e052575a10e41" }, "downloads": -1, "filename": "pyid-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "120c57bf5ea16671fd8524bc645188d4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2279, "upload_time": "2019-07-18T13:18:46", "url": "https://files.pythonhosted.org/packages/31/0d/ab8f774b0570d0b07361e50c89e04589bce20661b8ac9680decbe68a3545/pyid-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2df7b0a5d2b8493f4a9a99a0c2cc66f", "sha256": "91846651d747a8759cea474bc21764a318a4743a6fec32807a6d510f7cbd7cd5" }, "downloads": -1, "filename": "pyid-0.0.3.tar.gz", "has_sig": false, "md5_digest": "e2df7b0a5d2b8493f4a9a99a0c2cc66f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1958, "upload_time": "2019-07-18T13:18:47", "url": "https://files.pythonhosted.org/packages/f5/6b/b44d784600a75ff916bad5af7c528673135b0e02af1e4b71a83ee5a67438/pyid-0.0.3.tar.gz" } ] }