TIL - uuid.uuid5 Generate Deterministic Identifiers
uuid4 generates cryptographically random IDs, but uuid5 generates deterministic IDs based on a namespace and a name (a string). Same string, same UUID.
import uuid
# Random ID
print(uuid.uuid4())
# Deterministic ID based on a string URL
namespace = uuid.NAMESPACE_URL
deterministic_id = uuid.uuid5(namespace, "https://example.com")
print(deterministic_id)
# This will always be exactly identical for the same URL string
uuid5 is incredible for hashing strings into valid UUID formats for database primary keys without collisions.