gh-148740: Fix uuid CLI with custom UUIDs for UUIDv3/v5 namespaces#148741
gh-148740: Fix uuid CLI with custom UUIDs for UUIDv3/v5 namespaces#148741picnixz merged 9 commits intopython:mainfrom
uuid CLI with custom UUIDs for UUIDv3/v5 namespaces#148741Conversation
- This applies to generating version 3 and 5 UUIDs - Will correctly bail when invalid UUID is supplied as namespace
|
|
Please avoid updating your branch if the CI is green. See our devguide. It wastes CI resources |
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
picnixz
left a comment
There was a problem hiding this comment.
I see that there are some uuid3 tests that are put after the uuid4 tests. Can you move all your uuid3 tests before the existing uuid4 tests and update the comment of the uuid3 test about uuid5 format (it is in the existing test)
|
@picnixz I reordered the tests and fixed the comment you noticed. Thanks. |
uuid --uuid uuid{3,5} --namespace with custom UUIDs
- Update parser errror to be more succinct - Reorder tests so that good inputs come before invalid inputs
uuid --uuid uuid{3,5} --namespace with custom UUIDsuuid CLI with custom UUIDs for UUIDv3/v5 namespaces
|
Thanks @sumpygump for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @sumpygump for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Sorry, @sumpygump and @picnixz, I could not cleanly backport this to |
|
GH-149152 is a backport of this pull request to the 3.14 branch. |
|
@sumpygump Can you check if 3.13 is affected please and if so do the backport? TiA! |
|
@picnixz I checked python 3.13; this is NOT an issue in 3.13. |
…paces (python#148741) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Example usage with correction:
./python -m uuid --uuid uuid5 --namespace '0d6a16cc-34a7-47d8-b660-214d0ae184d2' --name some.user a32f4562-2058-5b20-8055-5f38b28285b6Example error if invalid UUID is supplied as
--namespaceargument:My solution was to update the argparse options to use
metavarinstead ofchoicesfor the namespaceargument. This allows to supply suggestions of options that can be supplied for the
--namespacearguments instead of requiring ONLY the ones in the list.My intent was to keep the help message consistent with how it looked before. Note that it still displays the possible values in the help text for the namespace:
-n, --namespace {any UUID,@dns,@url,@oid,@x500}: