Skip to main content

Generate UUID values (v4, v7) with flexible formatting and structured output options.

Project description

uuid-kit

Generate UUID values (v4, v7) with flexible formatting and structured output options.


Install

pip install uuid-kit

Usage

from uuid_kit import generate_uuid

result = generate_uuid(
    count=3,
    version="v7"
)

print(result)

Output

{
  "version": "v7",
  "format": "standard",
  "count": 3,
  "items": [
    "uuid-1",
    "uuid-2",
    "uuid-3"
  ]
}

Options

Field Type Required Default Description
count int No 1 Number of UUIDs to generate (min 1, max 100)
version string No v7 UUID version: v4 or v7
format string No standard Output format: standard, compact, uppercase, uppercase-compact
prefix string No "" Text to prepend to each UUID
suffix string No "" Text to append to each UUID
asObjects bool No False Return structured objects instead of strings

Formats

Format Example
standard 123e4567-e89b-12d3-a456-426614174000
compact 123e4567e89b12d3a456426614174000
uppercase 123E4567-E89B-12D3-A456-426614174000
uppercase-compact 123E4567E89B12D3A456426614174000

Examples

Default (v7)

generate_uuid(count=2)

v4

generate_uuid(count=2, version="v4")

Compact format

generate_uuid(count=2, format="compact")

Uppercase compact with prefix and suffix

generate_uuid(
    count=2,
    format="uppercase-compact",
    prefix="id_",
    suffix="_end"
)

Return objects

generate_uuid(count=2, asObjects=True)

Example output:

{
  "version": "v7",
  "format": "standard",
  "count": 2,
  "items": [
    {
      "uuid": "123e4567-e89b-12d3-a456-426614174000",
      "raw": "123e4567-e89b-12d3-a456-426614174000",
      "index": 0,
      "timestamp": {
        "iso": "2026-04-09T18:00:00Z",
        "unix": 1775757600000
      }
    },
    {
      "uuid": "123e4567-e89b-12d3-a456-426614174001",
      "raw": "123e4567-e89b-12d3-a456-426614174001",
      "index": 1,
      "timestamp": {
        "iso": "2026-04-09T18:00:00Z",
        "unix": 1775757600001
      }
    }
  ]
}

Supported Versions

  • v4 = random
  • v7 = modern time-based

Exports

from uuid_kit import generate_uuid
from uuid_kit import ALLOWED_FORMATS, ALLOWED_VERSIONS

Environment Notes

Some hosted Python runtimes require you to explicitly add packages before use. In those environments, add:

uuid-kit
uuid6

Behavior

  • Invalid or missing count defaults to 1
  • count is capped at 100
  • Invalid or missing version defaults to v7
  • Invalid or missing format defaults to standard

Notes

  • Python standard library does not yet include native UUID v7 support
  • To enable true v7 UUIDs, install:
pip install uuid6
  • If uuid6 is not installed, version="v7" falls back internally and will not produce a true v7 UUID

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uuid_kit-1.0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uuid_kit-1.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file uuid_kit-1.0.2.tar.gz.

File metadata

  • Download URL: uuid_kit-1.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for uuid_kit-1.0.2.tar.gz
Algorithm Hash digest
SHA256 df4a23abdaa2a2ae556f28905cede962502f2e5dd13eaf0cea77992a5a4fd0a4
MD5 1791ed779923cb3bebea21b8e551835d
BLAKE2b-256 62b61417fc4112060ddd5d5b3ea5a54ff7142f328f8e1422f6b9ff84ab6cbcb4

See more details on using hashes here.

File details

Details for the file uuid_kit-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: uuid_kit-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for uuid_kit-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 94609ad9eccc77bb850411b7ea5ee4cac5eafcdbc0399c6c2f8ada9db9a164ed
MD5 f81a0f74590b7d308727981362fbb44f
BLAKE2b-256 13303c30ffbf97594b7d22cea8073ce8fa5f937df9e0c1cdb42cf5824483cc46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page