Skip to main content

Centralized and robust service to manage unique identifiers (UUID) inside the Python ecosystem

Project description

Core Identifiers 🚀

Centralized and robust service to manage unique identifiers (UUID) inside the Python ecosystem.

This component was designed to be agnostic, allowing multiple projects (APIs, microservices) to use the same logic to generate IDs, ensuring consistency.

✨ Functionalities

  • UUID v4: Generates totally random IDs for sessions and transactions
  • UUID v4 Hex: Compact version (without dashes), ideal for file names or URL keys
  • UUID v5: Generates IDs based on Namespace and Input (e.g. email). The same input always generates the same ID — perfect to avoid duplicates in databases like MongoDB or MySQL
  • Static Typing: Fully compatible with mypy and modern IDEs (Type Hints)

🛠️ How to use

1. Project structure

Copy the UUID folder to the root of your project:

your_project/
├── UUID/
│   ├── __init__.py
│   └── identifier.py

2. Usage examples

from UUID.identifier import Identifier

# Random UUID v4
print(Identifier.v4())    # "550e8400-e29b-41d4-a716-446655440000"

# UUID v4 Hex (no dashes)
print(Identifier.hex())   # "550e8400e29b41d4a716446655440000"

# Deterministic UUID v5 (same input = same ID)
print(Identifier.v5("user@email.com"))  # always the same

🧪 Running Tests

Install pytest:

pip install pytest

Run all tests:

pytest tests/

Expected output:

tests/test_identifiers.py .....   5 passed in 0.02s

Test coverage

Test Description
test_uuid4_is_string Checks that UUID v4 returns a string
test_uuid4_format_valido Validates UUID v4 format
test_uuid4_hex Checks that hex version has no dashes
test_uuid5_deterministic Same input always returns same ID
test_uuid_v5_inputs_different Different inputs return different IDs

📁 Project Structure

core-identity/
├── UUID/
│   ├── __init__.py
│   └── identifier.py
├── tests/
│   ├── __init__.py
│   └── test_identifiers.py
├── README.md
└── LICENSE

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

core_identity-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

core_identity-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file core_identity-0.1.0.tar.gz.

File metadata

  • Download URL: core_identity-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for core_identity-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2c356e9b36b95e4c277a926b07ac9c0e185c9e704b5360d597d24ef64d5b4ad
MD5 ee6d390730b8bf784ee069419f67e90e
BLAKE2b-256 1616cf5ddba8a42cc1a7d53066d81861c252c98a14396aaa82483584fd31715c

See more details on using hashes here.

File details

Details for the file core_identity-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: core_identity-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for core_identity-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22d197ce74288c748c0b8d14e26e95a78fadeb62e20e62d340b1a72db6d0a4ba
MD5 d9c71a14e7ad31e7eff392a7b7dffd82
BLAKE2b-256 5ce4fd0a1b07964aa7b26b10c75448c05eaf78d8d4d933357910175651eb31ae

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