Registry / serialization / uuid
library1.30pypypi✓ verified 26d ago

This PyPI package (version 1.30) provides a backport of the `uuid` module's functionality for older Python versions, specifically 2.3 through 2.5. For Python 2.6 and newer, the `uuid` module is included in the Python standard library and this PyPI package is generally not needed. It was last released in 2006 and is not actively maintained.

pip install uuid
INSTALL
IMPORT
SIG · UUID
U
uuid
serializationpythonv1.30
Install
2.4s avg
Import
13ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.30 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.006s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

uuid
import uuid
Imports the module. Functions like uuid.uuid4() are then accessible.
UUID
from uuid import UUID my_uuid_obj = UUID('a1b2c3d4-e5f6-7890-1234-567890abcdef')
my_uuid_obj = uuid.UUID(['a1b2c3d4-e5f6-7890-1234-567890abcdef'])
The UUID class constructor expects a single string, bytes, a fields tuple, or an integer. Passing a list or other incorrect types will often lead to an AttributeError (e.g., trying to call .replace() on a list) rather than a direct TypeError.

Demonstrates generating version 1 and version 4 UUIDs, and reconstructing a UUID object from its string representation using the PyPI `uuid` package, which mirrors the standard library's API for older Python versions.

import uuid # Generate a random UUID (version 4) new_uuid = uuid.uuid4() print(f"Generated UUID (version 4): {new_uuid}") print(f"UUID as hex string: {new_uuid.hex}") # Generate a time-based UUID (version 1) # Note: uuid1() may expose the computer's MAC address. time_uuid = uuid.uuid1() print(f"Generated UUID (version 1): {time_uuid}") # Reconstruct a UUID from a string from uuid import UUID recovered_uuid = UUID(str(new_uuid)) print(f"Recovered UUID: {recovered_uuid}") print(f"Are they equal? {new_uuid == recovered_uuid}")
Debug
Known issues
breakingThis PyPI package (version 1.30) is a backport specifically for Python versions 2.3-2.5. For Python 2.6 and newer, the `uuid` module is included in the Python standard library. Installing this PyPI package on Python 2.6+ or Python 3.x is unnecessary and can lead to confusion or potential conflicts, as the standard library version should be used instead.
fix
For Python 2.6+, simply `import uuid` without `pip install uuid`. If you must support older Python 2.x versions (2.3-2.5), then `pip install uuid` is appropriate.
affects: < 2.6 (PyPI package intended for), >= 2.6 (standard library available)
gotchaThe `uuid.uuid1()` function generates a UUID using the computer's network address (MAC address) and the current time. This can compromise privacy if the generated UUIDs are exposed, as they could potentially be traced back to the originating machine.
fix
If privacy is a concern, prefer `uuid.uuid4()` for generating random UUIDs or `uuid.uuid7()` (available in Python 3.14+) for time-ordered UUIDs without MAC address exposure.
affects: All versions of the `uuid` module (both PyPI backport and standard library)
gotchaStoring UUIDs as plain strings in databases is inefficient. It consumes more space and can degrade query performance compared to using native UUID data types (e.g., in PostgreSQL) or storing them as 16-byte binary data.
fix
Use your database's native UUID type if available (e.g., `UUID` in PostgreSQL). If not, store UUIDs as 16-byte binary fields (e.g., `VARBINARY(16)` or `BINARY(16)`) and convert using `my_uuid.bytes` in Python.
affects: All Python versions, dependent on database usage.
gotchaThis specific PyPI `uuid` package (v1.30) and older standard library versions only support UUID versions 1, 3, 4, and 5. Newer, potentially more optimized or privacy-friendly versions like UUIDv6, UUIDv7, and UUIDv8 were added to the standard library starting with Python 3.14.
fix
If you require newer UUID versions (6, 7, or 8), you must use Python 3.14 or a newer version of the standard library. Otherwise, adhere to versions 1, 3, 4, or 5. Consider `uuid4()` for general randomness.
affects: PyPI `uuid` 1.30 and Python standard library < 3.14
gotchaWhile UUIDs are designed to be highly unique (e.g., collision probability for UUIDv4 is extremely low), they are not absolutely guaranteed to be unique. In extremely high-volume, distributed systems, theoretical collision possibilities exist.
fix
For mission-critical applications where absolute uniqueness is paramount, consider implementing additional collision detection logic or relying on database-side UUID generation functions where the database ensures uniqueness with constraints.
affects: All UUID versions and Python versions.
gotchaThe hardware address retrieved by `uuid.getnode()` (used internally by `uuid.uuid1()`) is tied to the system's network interfaces and can change if network configurations are altered (e.g., switching Wi-Fi, using USB Ethernet adapters).
fix
Avoid relying on `uuid1()` for persistent identifiers that must remain constant across hardware or network changes. Use `uuid4()` or name-based UUIDs (`uuid3()`, `uuid5()`) instead, or store and reuse a generated UUID.
affects: All versions of the `uuid` module that use `uuid1()` or `getnode()`
Upgrade
Version history
1.30latest on PyPI · released May 26, 2007
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources