Skip to main content

Developers Toolbox

UUID Generator

Generate UUID versions 1, 3, 4, 5, 6, 7, and 8. Format the result (case, separator, length, prefix, suffix), or draw a custom alphabet when a standard UUID is not what you need. The command can also print each UUID as URL-safe Base64 or as an MD5 digest.

The PyPI name is lupaxa-uuid-generator. The import path is lupaxa.uuid_generator. The console script is uuid-generator. lupaxa is a namespace package — there is no lupaxa/__init__.py.

Public names: UUIDGenerator, UUIDGeneratorError, __version__, get_version().

Install

pip install lupaxa-uuid-generator

Requires Python 3.10+. There are no runtime dependencies.

Versions

Version Example Where to Use
1 a28f767c-c2f2-11f1-9234-001122334455 Time and a node. Use when you need to trace the host that created the id. The node may be a MAC address.
3 9073926b-929f-31c2-abc9-fad77ae3e8eb MD5 of a namespace and a name. Use when the same name must always produce the same id.
4 225b1555-69c6-4d7c-84e0-b71f52d070d1 Random bits, with no time or host. Use as the default when the id only has to be unique.
5 cfbff0d1-9375-5685-968c-48ce8b15ae17 SHA-1 of a namespace and a name. Use for the same stable ids as version 3, with SHA-1.
6 1f1c2f2a-28f7-667c-9234-001122334455 Version 1 time and node, reordered so the values sort. Use when those ids should be stored in creation order.
7 01a11aa3-322a-75c6-b387-783eed46490c Unix time in milliseconds, then random bits. Use for sortable ids that do not reveal a machine address.
8 00001234-5678-8ef0-8000-000011223344 Your own 48, 12, and 62 bit blocks. Use for a private layout that still has to be a valid UUID.

Versions 3 and 5 use the DNS namespace and the name example.com. Versions 1 and 6 share the placeholder node 00:11:22:33:44:55. Version 8 is a=0x12345678, b=0x9abcdef0, c=0x11223344. Versions 4 and 7 are single samples. Another call will differ.

Library

generate_uuid takes one config mapping and can format the result. create_uuid takes arguments and returns the raw UUID. Version 8 blocks are a, b, and c either way, the same values as uuid.uuid8(a, b, c).

Generate UUID

import uuid

from lupaxa.uuid_generator import UUIDGenerator

UUIDGenerator.generate_uuid()
UUIDGenerator.generate_uuid({"version": 1})
UUIDGenerator.generate_uuid({"version": 6})
UUIDGenerator.generate_uuid({"version": 7})
UUIDGenerator.generate_uuid(
    {"version": 8, "a": 0x12345678, "b": 0x9ABCDEF0, "c": 0x11223344}
)
UUIDGenerator.generate_uuid(
    {
        "version": 5,
        "namespace": uuid.NAMESPACE_DNS,
        "name": "example.com",
        "format_type": "uppercase",
        "prefix": "id-",
    }
)

Create UUID

import uuid

from lupaxa.uuid_generator import UUIDGenerator

UUIDGenerator.create_uuid()
UUIDGenerator.create_uuid(1)
UUIDGenerator.create_uuid(3, uuid.NAMESPACE_DNS, "example.com")
UUIDGenerator.create_uuid(5, uuid.NAMESPACE_DNS, "example.com")
UUIDGenerator.create_uuid(6)
UUIDGenerator.create_uuid(7)
UUIDGenerator.create_uuid(8, a=0x12345678, b=0x9ABCDEF0, c=0x11223344)
Key Meaning
version 1, 3, 4, 5, 6, 7, or 8. Default is 4
a Version 8 block, 48 bits. Same as uuid.uuid8
b Version 8 block, 12 bits. Extra high bits are ignored
c Version 8 block, 62 bits. Omitted blocks are random
namespace uuid.UUID. Required for versions 3 and 5
name String mixed into versions 3 and 5
format_type standard, uppercase, lowercase, or no-dashes
separator Replacement for -. Default is -
length Keep this many characters after formatting
prefix Text placed before the identifier
suffix Text placed after the identifier
custom_char_set Alphabet for a non-UUID identifier. Requires length

Version 6 reorders the version 1 timestamp so values sort, and keeps that same clock sequence and node. Version 7 needs no namespace. Its first 48 bits are Unix time in milliseconds, so values from one process sort by creation time. Version 8 uses the same a, b, and c blocks as uuid.uuid8: 48, 12, and 62 bits. Wider integers keep their low bits. An omitted block is filled at random.

apply_format and add_prefix_suffix are the steps generate_uuid runs after create_uuid. encode_uuid and decode_uuid use URL-safe Base64. hash_uuid accepts sha256 (default) or md5. generate_unique_uuid retries until the value is absent from the list you pass.

from lupaxa.uuid_generator import UUIDGenerator, UUIDGeneratorError

try:
    UUIDGenerator.generate_uuid({"version": 5})
except UUIDGeneratorError as exc:
    print(exc)

UUIDGeneratorError is a ValueError.

CLI

uuid-generator
uuid-generator -n 3
uuid-generator --uuid-version 1
uuid-generator --uuid-version 6
uuid-generator --uuid-version 7
uuid-generator --uuid-version 8 --a 0x12345678 --b 0x9abcdef0 --c 0x11223344
uuid-generator --base64
uuid-generator --md5
uuid-generator --base64 --md5
uuid-generator --uuid-version 5 --namespace dns --name example.com
uuid-generator --format no-dashes --prefix id-
uuid-generator --version

One identifier is printed per line. The default is a single version 4 UUID.

Flag Meaning
-n, --count How many to print. Default is 1
--uuid-version 1, 3, 4, 5, 6, 7, or 8. Default is 4
--a Version 8 block a, 48 bits. Hex with 0x is fine
--b Version 8 block b, 12 bits
--c Version 8 block c, 62 bits
--namespace dns, url, oid, x500, or a UUID. Versions 3/5
--name Name for versions 3 and 5
--format standard, uppercase, lowercase, or no-dashes
--separator Replacement for -
--length Keep the first N characters
--prefix Text before each identifier
--suffix Text after each identifier
--base64 URL-safe Base64 of each UUID, padding stripped
--md5 MD5 hex digest of each UUID string
--version Print uuid-generator x.y.z and exit 0
--help Show argparse help
Result Stdout Exit
Success One identifier per line 0
--version uuid-generator x.y.z 0
Bad count, namespace, or flags error on stderr 2

--base64 and --md5 both describe the identifier that would have been printed. Together they print the Base64 form, a space, then the MD5 digest. --base64 needs a value uuid.UUID can parse, so a prefix, suffix, custom separator, or shortened length exits 2. Custom alphabets stay on the library.

Development

make init
make python-install-dev
make python-check
The Lupaxa Project Footer

Metadata

Release files for lupaxa-uuid-generator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lupaxa-uuid-generator 0.1.0
File Size Uploaded
lupaxa_uuid_generator-0.1.0.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lupaxa-uuid-generator 0.1.0
File Interpreter ABI Platform
lupaxa_uuid_generator-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / lupaxa_uuid_generator-0.1.0.tar.gz

Download URL lupaxa_uuid_generator-0.1.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6bbc2d8e963143416e18c4ed095a6df85d599d218b14bb384a675dea6f8eb5c3
BLAKE2b-256 checksum
How to use checksums
6680086b761d4098da517b5b9934e7d493605228af5fb4528a44e375837cfa93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / lupaxa_uuid_generator-0.1.0-py3-none-any.whl

Download URL lupaxa_uuid_generator-0.1.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8f8160bf6677ea9ed4aa34981e488550cc5cbb2577c2776ffe64e943a79dfee
BLAKE2b-256 checksum
How to use checksums
541fc96d18b93c4962b32bd350852d5f63da458457d47540692297320a1b7f95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page