{"id":13493208,"url":"https://github.com/aminalaee/uuid-utils","last_synced_at":"2025-10-23T18:09:24.934Z","repository":{"id":147935142,"uuid":"618921978","full_name":"aminalaee/uuid-utils","owner":"aminalaee","description":"Python bindings to Rust UUID","archived":false,"fork":false,"pushed_at":"2024-04-30T07:10:24.000Z","size":59,"stargazers_count":78,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-01T16:48:25.787Z","etag":null,"topics":["python","rust","uuid","uuid-generator","uuidv7"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aminalaee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-25T18:29:26.000Z","updated_at":"2024-05-02T16:56:24.093Z","dependencies_parsed_at":null,"dependency_job_id":"fb98f85f-17de-4b16-b104-bcaac8d5a079","html_url":"https://github.com/aminalaee/uuid-utils","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminalaee%2Fuuid-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminalaee%2Fuuid-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminalaee%2Fuuid-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminalaee%2Fuuid-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aminalaee","download_url":"https://codeload.github.com/aminalaee/uuid-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430966,"owners_count":20937875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","rust","uuid","uuid-generator","uuidv7"],"created_at":"2024-07-31T19:01:13.193Z","updated_at":"2025-10-23T18:09:24.926Z","avatar_url":"https://github.com/aminalaee.png","language":"Python","readme":"# Python UUID Utils\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pypi.org/project/uuid-utils/\"\u003e\n    \u003cimg src=\"https://badge.fury.io/py/uuid-utils.svg\" alt=\"Package version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/uuid-utils\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/uuid-utils.svg?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nPython UUID implementation using Rust's UUID library.\nThis will make `uuid4` function around 10x faster.\n\nThis package can be a drop-in replacement to the standard library UUID.\n\nAvaialble UUID versions:\n\n- `uuid1` - Version 1 UUIDs using a timestamp and monotonic counter.\n- `uuid3` - Version 3 UUIDs based on the MD5 hash of some data.\n- `uuid4` - Version 4 UUIDs with random data.\n- `uuid5` - Version 5 UUIDs based on the SHA1 hash of some data.\n- `uuid6` - Version 6 UUIDs using a timestamp and monotonic counter.\n- `uuid7` - Version 7 UUIDs using a Unix timestamp ordered by time.\n- `uuid8` - Version 8 UUIDs using user-defined data.\n\n## Installation\nUsing `pip`:\n```shell\n$ pip install uuid-utils\n```\nor, using `conda`:\n\n```shell\n$ conda install -c conda-forge uuid-utils\n```\n\n## Example\n\n```shell\n\u003e\u003e\u003e import uuid_utils as uuid\n\n\u003e\u003e\u003e # make a random UUID\n\u003e\u003e\u003e uuid.uuid4()\nUUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')\n\n\u003e\u003e\u003e # make a random UUID using a Unix timestamp which is time-ordered.\n\u003e\u003e\u003e uuid.uuid7()\nUUID('018afa4a-0d21-7e6c-b857-012bc678552b')\n\n\u003e\u003e\u003e # make a UUID using a SHA-1 hash of a namespace UUID and a name\n\u003e\u003e\u003e uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\nUUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n\n\u003e\u003e\u003e # make a UUID using an MD5 hash of a namespace UUID and a name\n\u003e\u003e\u003e uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\nUUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n```\n\n## Compatibility\n\nIn some cases, for example if you are using `Django`, you might need `UUID` instances to be returned\nfrom the standrad-library `uuid`, not a custom `UUID` class.\nIn that case you can use the `uuid_utils.compat` which comes with a performance penalty\nin comparison with the `uuid_utils` default behaviour, but is still faster than the standard-library.\n\n```py\n\u003e\u003e\u003e import uuid_utils.compat as uuid\n\n\u003e\u003e\u003e # make a random UUID\n\u003e\u003e\u003e uuid.uuid4()\nUUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')\n```\n\n## Benchmarks\n\n|        Benchmark | Min     | Max     | Mean    | Min (+)         | Max (+)         | Mean (+)        |\n|------------------|---------|---------|---------|-----------------|-----------------|-----------------|\n|          UUID v1 | 0.061   | 0.299   | 0.194   | 0.019 (3.3x)    | 0.019 (15.4x)   | 0.019 (10.1x)   |\n|          UUID v3 | 0.267   | 0.307   | 0.293   | 0.035 (7.6x)    | 0.041 (7.5x)    | 0.039 (7.5x)    |\n|          UUID v4 | 0.145   | 0.301   | 0.249   | 0.004 (38.5x)   | 0.005 (54.8x)   | 0.005 (53.0x)   |\n|          UUID v5 | 0.058   | 0.189   | 0.146   | 0.008 (7.6x)    | 0.038 (5.0x)    | 0.016 (9.0x)    |\n|    UUID from hex | 0.128   | 0.139   | 0.135   | 0.016 (8.2x)    | 0.017 (8.0x)    | 0.016 (8.3x)    |\n|  UUID from bytes | 0.031   | 0.135   | 0.093   | 0.016 (2.0x)    | 0.016 (8.6x)    | 0.016 (5.9x)    |\n|    UUID from int | 0.027   | 0.102   | 0.043   | 0.003 (8.3x)    | 0.004 (25.0x)   | 0.003 (12.4x)   |\n| UUID from fields | 0.031   | 0.162   | 0.077   | 0.005 (6.0x)    | 0.005 (30.6x)   | 0.005 (14.7x)   |\n\n\u003csup\u003eBenchmark results might vary in different environments, but in most cases the uuid_utils should outperform stdlib uuid.\u003c/sup\u003e\u003cbr\u003e\n\n## How to develop locally\n\n```shell\n$ make build\n$ make test\n```\n\nOr:\n\n```shell\n$ RUSTFLAGS=\"--cfg uuid_unstable\" maturin develop --release\n```\n","funding_links":[],"categories":["Python","Utilities"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminalaee%2Fuuid-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faminalaee%2Fuuid-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminalaee%2Fuuid-utils/lists"}