Skip to content
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

use token_urlsafe instead of shortuuid to generate temp file #269

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

skshetry
Copy link
Member

@skshetry skshetry commented Jan 9, 2024

Python>=3.6 has secrets.token_urlsafe that can create cryptographically safe strings/numbers. So we don't need to use shortuuid. The generated text string is of the same size as shortuuid.uuid(), but can contain underscore and hyphen characters (not just alpha-numeric values), which might make it less human-readable. But I am not sure if it's worth it to use a third-party library (which can be gradually removed).

token_urlsafe is also 4x faster than shortuuid.uuid().

Python>=3.6 has secrets.token_urlsafe that can create cryptographically
safe strings/numbers. So we don't need to use shortuuid.
The generated text string is of the same size as `shortuuid.uuid()`,
but can contain underscore and hyphen characters (not just alpha-numeric values),
which might make it less human-readable. But I am not sure if it's worth it to use
a third-party library (which can be gradually removed).
@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6e80fbe) 63.37% compared to head (0c6f275) 63.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #269      +/-   ##
==========================================
- Coverage   63.37%   63.35%   -0.02%     
==========================================
  Files          26       26              
  Lines        2105     2104       -1     
  Branches      336      336              
==========================================
- Hits         1334     1333       -1     
  Misses        720      720              
  Partials       51       51              

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

@skshetry skshetry merged commit 63ed7de into main Jan 9, 2024
16 checks passed
@skshetry skshetry deleted the remove-shortuuid branch January 9, 2024 08:09
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