{ "info": { "author": "oaclaf", "author_email": "oaclafm@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "==========================================\nuuid0 - better timestamped UUIDs in Python\n==========================================\n\nV4 UUIDs are often used as primary keys or as part of database indexes.\nHowever, their random and non-sequential nature can cause locality and \nperformance issues.\n\nThis Python 3 package mitigates these issues by using encoding a UNIX\ntimestamp in the first 6 bytes of the UUID, and filling the remaining bytes\nwith random data. The ``uuid0.UUID`` class inherits from the standard \n``uuid.UUID`` class so it's safe to use all the usual properties (hex, int, \nbytes, etc.)\n\nThe package also contains ``uuid0.django`` which provides Django form and\nmodel fields based on the UUID0 type, as well as an abstract ``UUID0Model``.\n\n------\nStatus\n------\n\nThis package is in **alpha** status, use at your own risk.\n\n-----\nUsage\n-----\n\nInstall by running::\n\n pip install uuid0\n\nExample usage::\n\n >>> import uuid0\n\n # make a UUID based on the current time\n >>> uuid0.generate()\n UUID('0dc7ef03-c534-d288-67b7-34cf4dfa9350')\n\n # make a UUID from a string of hex digits (braces and hyphens ignored)\n >>> x = uuid0.UUID('{0b7dd8d0-7e40-8360-9322-4a361d7b573f}')\n\n # extract the datetime from a UUID\n >>> str(x.datetime)\n '2010-01-15 00:00:36'\n\n # convert a UUID to a string of hex digits in standard form\n >>> str(x)\n '0b7dd8d0-7e40-8360-9322-4a361d7b573f'\n\n # convert a UUID to a base62 string\n >>> x.base62\n 'LgQWTxkOpLyTaEuRAav9D'\n\n # make a UUID from a base62 string\n >>> uuid0.UUID(base62=x.base62)\n UUID('0b7dd8d0-7e40-8360-9322-4a361d7b573f')\n\n # get the raw 16 bytes of the UUID\n >>> x.bytes\n b'\\x0b}\\xd8\\xd0~@\\x83`\\x93\"J6\\x1d{W?'\n\n # make a UUID from a 16-byte string\n >>> uuid0.UUID(bytes=x.bytes)\n UUID('0b7dd8d0-7e40-8360-9322-4a361d7b573f')\n\n----------------------\nWhat about collisions?\n----------------------\n\nCollisions are a concern, of course, but only if you are generating really\n**large** amounts of UUIDs in a short timespan.\n\nBy default, uuid0 only uses 6 bytes to encode the time and does not encode any\nversion bits, leaving 10 bytes (80 bits) of random data.\n\nThe probability of collision is near zero for most use cases since for each \n1/10000s period, there are 2\\ :sup:`80` possible UUIDs.\n\n-----------\nPerformance\n-----------\n\nGenerating a UUID0 is slower than generating a UUID v4, but faster than a \nUUID v1.\n\nBelow are results for 500k iterations on an i7-6700HQ and Python 3.6.2 \n(generated using the ``benchmarks/generate.py`` script):\n\n================= ========= ========= ========\nmethod it/s ?s/it % slower\n================= ========= ========= ========\nuuid.uuid4() 453043 2.207 0.0%\nuuid0.generate() 311184 3.214 31.31%\nuuid.uuid1() 230163 4.345 49.2%\n================= ========= ========= ========\n\nIn terms of database performance, indexes are approximately 18% smaller and\ninserts about 23% faster on PostgreSQL with a ``uuid`` type column, but YMMV\ndepending on your use case.\n\n-------\nLicense\n-------\n\nThis project is licensed under the MIT License. See the ``LICENSE`` file for\ndetails.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oaclaf/uuid0", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "uuid0", "package_url": "https://pypi.org/project/uuid0/", "platform": "", "project_url": "https://pypi.org/project/uuid0/", "project_urls": { "Homepage": "https://github.com/oaclaf/uuid0" }, "release_url": "https://pypi.org/project/uuid0/0.2.7/", "requires_dist": [ "pybase62" ], "requires_python": "", "summary": "A library to make better timestamped UUIDs for databases and web apps", "version": "0.2.7" }, "last_serial": 3771329, "releases": { "0.2.7": [ { "comment_text": "", "digests": { "md5": "576680fc8d647340efc29b069095fbb4", "sha256": "b200bd88098010cef5f4445ac0f1c6fe60e021f0478fb3968e943adc1e89b902" }, "downloads": -1, "filename": "uuid0-0.2.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "576680fc8d647340efc29b069095fbb4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9300, "upload_time": "2018-01-18T18:06:56", "url": "https://files.pythonhosted.org/packages/97/64/a73d68952996907b22828754d8fd9ed0536c7455033957d06d1fb00f5cea/uuid0-0.2.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2bba0d1df77973734995aa9a5961971e", "sha256": "835da1b868078eadfd63de24d17b9ea3bd1c655497f99e1b8b84f6e4117e6c2b" }, "downloads": -1, "filename": "uuid0-0.2.7.tar.gz", "has_sig": false, "md5_digest": "2bba0d1df77973734995aa9a5961971e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5495, "upload_time": "2018-01-18T18:06:57", "url": "https://files.pythonhosted.org/packages/76/5b/f9cfca063b788e2cfcd4ff03ac04fa8b80ddea629a84b3e292bc6f1dcc8a/uuid0-0.2.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "576680fc8d647340efc29b069095fbb4", "sha256": "b200bd88098010cef5f4445ac0f1c6fe60e021f0478fb3968e943adc1e89b902" }, "downloads": -1, "filename": "uuid0-0.2.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "576680fc8d647340efc29b069095fbb4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9300, "upload_time": "2018-01-18T18:06:56", "url": "https://files.pythonhosted.org/packages/97/64/a73d68952996907b22828754d8fd9ed0536c7455033957d06d1fb00f5cea/uuid0-0.2.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2bba0d1df77973734995aa9a5961971e", "sha256": "835da1b868078eadfd63de24d17b9ea3bd1c655497f99e1b8b84f6e4117e6c2b" }, "downloads": -1, "filename": "uuid0-0.2.7.tar.gz", "has_sig": false, "md5_digest": "2bba0d1df77973734995aa9a5961971e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5495, "upload_time": "2018-01-18T18:06:57", "url": "https://files.pythonhosted.org/packages/76/5b/f9cfca063b788e2cfcd4ff03ac04fa8b80ddea629a84b3e292bc6f1dcc8a/uuid0-0.2.7.tar.gz" } ] }