Skip to content

Update uuid to uuid7 #2303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Update uuid to uuid7 #2303

wants to merge 8 commits into from

Conversation

auvipy
Copy link
Member

@auvipy auvipy commented May 28, 2025

No description provided.

Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.51%. Comparing base (0e04303) to head (70f8def).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
kombu/utils/uuid.py 69.23% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2303      +/-   ##
==========================================
- Coverage   81.54%   81.51%   -0.03%     
==========================================
  Files          77       77              
  Lines        9546     9555       +9     
  Branches     1163     1165       +2     
==========================================
+ Hits         7784     7789       +5     
- Misses       1570     1573       +3     
- Partials      192      193       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@auvipy auvipy requested a review from Copilot May 28, 2025 09:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the UUID generation utility to support UUID version 7 while retaining support for UUID4 as a fallback option. Key changes include switching the function parameter from a Callable to a version literal and introducing a try/except block for importing uuid7 with a fallback implementation.

@auvipy auvipy added this to the 5.7.0 milestone May 28, 2025
@auvipy
Copy link
Member Author

auvipy commented May 28, 2025

this will need tests update and thorough testing before merge

@WilliamDEdwards
Copy link

My $0.02: it should still be possible to manually specify UUID4s - to not break the case where pre-generated UUID4s are passed to signatures.

@auvipy
Copy link
Member Author

auvipy commented May 28, 2025

My $0.02: it should still be possible to manually specify UUID4s - to not break the case where pre-generated UUID4s are passed to signatures.

would you mind elaborate a bit more please? so that I can clearly understand what you wanted to be done here?

@WilliamDEdwards
Copy link

My $0.02: it should still be possible to manually specify UUID4s - to not break the case where pre-generated UUID4s are passed to signatures.

would you mind elaborate a bit more please? so that I can clearly understand what you wanted to be done here?

Sure:

This use case should not break:

import uuid

repositories.celery.infrastructure.celery_app.signature(
        result.name,
        immutable=task.immutable,
        args=result.args,
        kwargs=result.kwargs,
).set(task_id=str(uuid.uuid4()))  # <<< Notice this

@auvipy
Copy link
Member Author

auvipy commented May 28, 2025

OK, thanks a lot!

@auvipy auvipy self-assigned this May 28, 2025
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