Skip to content

deps: remove uuid and uuid6 packages#251

Closed
PeakPy wants to merge 1 commit intobenavlabs:mainfrom
PeakPy:feature/remove-uuid-uuid6
Closed

deps: remove uuid and uuid6 packages#251
PeakPy wants to merge 1 commit intobenavlabs:mainfrom
PeakPy:feature/remove-uuid-uuid6

Conversation

@PeakPy
Copy link

@PeakPy PeakPy commented Feb 12, 2026

This PR addresses the "UUID usage" part of issue #248 by removing the direct dependency on external uuid / uuid6 packages and relying on Python's built-in uuid module instead.

Changes:

  • Remove uuid and uuid6 from project dependencies in pyproject.toml.
  • Replace uuid7 usage with uuid.uuid4() in:
    • src/scripts/create_first_superuser.py
    • src/app/models/user.py
    • src/app/models/post.py
    • src/app/core/schemas.py
    • src/app/core/db/models.py
  • Update tests to use uuid.uuid4() in tests/conftest.py.

Tests:

  • uv run pytest
  • uv run ruff check src
  • uv run mypy src

This is a follow-up to issue #248.

@LucasQR
Copy link
Collaborator

LucasQR commented Feb 17, 2026

The codebase uses UUID v7 (uuid7), not UUID v4. Python's built-in uuid module only provides uuid1, uuid3, uuid4, and uuid5 — it does not support UUID v7.

UUID v7 (RFC 9562) is specifically chosen here because it's time-ordered, which matters for database performance. Random UUID v4 values scatter inserts across B-tree indexes, causing page splits and bloat in PostgreSQL. UUID v7 embeds a timestamp in the most significant bits, so values are generated in chronological rder and append to the end of the index — similar to auto-incrementing integers but without sacrificing global uniqueness.

The uuid6 package is a small, focused library that fills this gap in the stdlib. It's not a redundant wrapper around uuid it provides functionality that doesn't exist there yet.

@LucasQR LucasQR closed this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments