Name | uuid25 JSON |
Version |
0.1.4
JSON |
| download |
home_page | https://github.com/uuid25/python |
Summary | 25-digit case-insensitive UUID encoding |
upload_time | 2025-01-12 17:02:53 |
maintainer | None |
docs_url | None |
author | LiosK |
requires_python | >=3.9 |
license | Apache-2.0 |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Uuid25: 25-digit case-insensitive UUID encoding
[](https://pypi.org/project/uuid25/)
[](https://github.com/uuid25/python/blob/main/LICENSE)
Uuid25 is an alternative UUID representation that shortens a UUID string to just
25 digits using the case-insensitive Base36 encoding. This library provides
functionality to convert from the conventional UUID formats to Uuid25 and vice
versa.
```python
from uuid25 import Uuid25
# convert from/to string
a = Uuid25.parse("8da942a4-1fbe-4ca6-852c-95c473229c7d")
assert a.value == "8dx554y5rzerz1syhqsvsdw8t"
assert a.to_hyphenated() == "8da942a4-1fbe-4ca6-852c-95c473229c7d"
# convert from/to 128-bit byte array
b = Uuid25.from_bytes(bytes([0xFF] * 16))
assert b.value == "f5lxx1zz5pnorynqglhzmsp33"
assert all([x == 0xFF for x in b.to_bytes()])
# convert from/to other popular textual representations
c = [
Uuid25.parse("e7a1d63b711744238988afcf12161878"),
Uuid25.parse("e7a1d63b-7117-4423-8988-afcf12161878"),
Uuid25.parse("{e7a1d63b-7117-4423-8988-afcf12161878}"),
Uuid25.parse("urn:uuid:e7a1d63b-7117-4423-8988-afcf12161878"),
]
assert all([x.value == "dpoadk8izg9y4tte7vy1xt94o" for x in c])
d = Uuid25.parse("dpoadk8izg9y4tte7vy1xt94o")
assert d.to_hex() == "e7a1d63b711744238988afcf12161878"
assert d.to_hyphenated() == "e7a1d63b-7117-4423-8988-afcf12161878"
assert d.to_braced() == "{e7a1d63b-7117-4423-8988-afcf12161878}"
assert d.to_urn() == "urn:uuid:e7a1d63b-7117-4423-8988-afcf12161878"
# convert from/to standard uuid module's UUID value
import uuid
uuid_module = uuid.UUID("f38a6b1f-576f-4c22-8d4a-5f72613483f6")
e = Uuid25.from_uuid(uuid_module)
assert e.value == "ef1zh7jc64vprqez41vbwe9km"
assert e.to_uuid() == uuid_module
# generate UUIDv4 in Uuid25 format (backed by uuid module)
import uuid25
print(uuid25.gen_v4()) # e.g., "99wfqtl0z0yevxzpl4hv2dm5p"
```
## License
Licensed under the Apache License, Version 2.0.
Raw data
{
"_id": null,
"home_page": "https://github.com/uuid25/python",
"name": "uuid25",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "LiosK",
"author_email": "contact@mail.liosk.net",
"download_url": "https://files.pythonhosted.org/packages/7e/f5/bfe37879bfbe54bec8acc328c19380dfcfd477fc79352d2a2d2e96dff500/uuid25-0.1.4.tar.gz",
"platform": null,
"description": "# Uuid25: 25-digit case-insensitive UUID encoding\n\n[](https://pypi.org/project/uuid25/)\n[](https://github.com/uuid25/python/blob/main/LICENSE)\n\nUuid25 is an alternative UUID representation that shortens a UUID string to just\n25 digits using the case-insensitive Base36 encoding. This library provides\nfunctionality to convert from the conventional UUID formats to Uuid25 and vice\nversa.\n\n```python\nfrom uuid25 import Uuid25\n\n# convert from/to string\na = Uuid25.parse(\"8da942a4-1fbe-4ca6-852c-95c473229c7d\")\nassert a.value == \"8dx554y5rzerz1syhqsvsdw8t\"\nassert a.to_hyphenated() == \"8da942a4-1fbe-4ca6-852c-95c473229c7d\"\n\n# convert from/to 128-bit byte array\nb = Uuid25.from_bytes(bytes([0xFF] * 16))\nassert b.value == \"f5lxx1zz5pnorynqglhzmsp33\"\nassert all([x == 0xFF for x in b.to_bytes()])\n\n# convert from/to other popular textual representations\nc = [\n Uuid25.parse(\"e7a1d63b711744238988afcf12161878\"),\n Uuid25.parse(\"e7a1d63b-7117-4423-8988-afcf12161878\"),\n Uuid25.parse(\"{e7a1d63b-7117-4423-8988-afcf12161878}\"),\n Uuid25.parse(\"urn:uuid:e7a1d63b-7117-4423-8988-afcf12161878\"),\n]\nassert all([x.value == \"dpoadk8izg9y4tte7vy1xt94o\" for x in c])\n\nd = Uuid25.parse(\"dpoadk8izg9y4tte7vy1xt94o\")\nassert d.to_hex() == \"e7a1d63b711744238988afcf12161878\"\nassert d.to_hyphenated() == \"e7a1d63b-7117-4423-8988-afcf12161878\"\nassert d.to_braced() == \"{e7a1d63b-7117-4423-8988-afcf12161878}\"\nassert d.to_urn() == \"urn:uuid:e7a1d63b-7117-4423-8988-afcf12161878\"\n\n# convert from/to standard uuid module's UUID value\nimport uuid\n\nuuid_module = uuid.UUID(\"f38a6b1f-576f-4c22-8d4a-5f72613483f6\")\ne = Uuid25.from_uuid(uuid_module)\nassert e.value == \"ef1zh7jc64vprqez41vbwe9km\"\nassert e.to_uuid() == uuid_module\n\n# generate UUIDv4 in Uuid25 format (backed by uuid module)\nimport uuid25\n\nprint(uuid25.gen_v4()) # e.g., \"99wfqtl0z0yevxzpl4hv2dm5p\"\n```\n\n## License\n\nLicensed under the Apache License, Version 2.0.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "25-digit case-insensitive UUID encoding",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/uuid25/python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6adbcf5ae032afcbedbeb6cfea84a5aa316ac67b8d8dae5bfce5ab66b9283435",
"md5": "7ce01e7a978c38dcb47bb0d1a4241ec2",
"sha256": "2bcae38e4ab6d1df33a32df5a23679565a099895795df4310c02aad3521e537a"
},
"downloads": -1,
"filename": "uuid25-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ce01e7a978c38dcb47bb0d1a4241ec2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8705,
"upload_time": "2025-01-12T17:02:51",
"upload_time_iso_8601": "2025-01-12T17:02:51.764062Z",
"url": "https://files.pythonhosted.org/packages/6a/db/cf5ae032afcbedbeb6cfea84a5aa316ac67b8d8dae5bfce5ab66b9283435/uuid25-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7ef5bfe37879bfbe54bec8acc328c19380dfcfd477fc79352d2a2d2e96dff500",
"md5": "bde31b9d611276af6ce0d47873c1b96f",
"sha256": "3a3a39284475815cebd8b17cd68619e45b3cceac178b1e2e0c03d69a52af1a52"
},
"downloads": -1,
"filename": "uuid25-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "bde31b9d611276af6ce0d47873c1b96f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 7421,
"upload_time": "2025-01-12T17:02:53",
"upload_time_iso_8601": "2025-01-12T17:02:53.218378Z",
"url": "https://files.pythonhosted.org/packages/7e/f5/bfe37879bfbe54bec8acc328c19380dfcfd477fc79352d2a2d2e96dff500/uuid25-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-12 17:02:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "uuid25",
"github_project": "python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "uuid25"
}