← 返回首页
GH-88597: Added command line interface to UUID module. by achhina · Pull Request #99463 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

GH-88597: Added command line interface to UUID module.#99463

Merged
gpshead merged 3 commits into
python:mainfrom
achhina:GH-88597
Jan 22, 2023
Merged

GH-88597: Added command line interface to UUID module.#99463
gpshead merged 3 commits into
python:mainfrom
achhina:GH-88597

Conversation

achhina commented Nov 14, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

UUID module now supports command line usage.

❯ ./python.exe -m uuid 5f2d57b1-90e8-417c-ba5d-69b9b6f74289 ❯ ./python.exe -m uuid -h usage: uuid.py [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-ns NAMESPACE] [-n NAME] Generates a uuid using the selected uuid function. options: -h, --help show this help message and exit -u {uuid1,uuid3,uuid4,uuid5}, --uuid {uuid1,uuid3,uuid4,uuid5} The function to use to generate the uuid. By default uuid4 function is used. -ns NAMESPACE, --namespace NAMESPACE The namespace used as part of generating the uuid. Only required for uuid3/uuid5 functions. -n NAME, --name NAME The name used as part of generating the uuid. Only required for uuid3/uuid5 functions.
  • Tests ran locally

achhina commented Nov 14, 2022

Copy link
Copy Markdown
Contributor Author

Hi @nanjekyejoannah, as you reviewed the first PR for this issue, would you be able to take a look at this one when you get a chance? I ended up moving the CLI logic to a separate function and importing & using argparse only in there to keep the rest of the module lightweight.

Comment thread Lib/uuid.py Outdated Show resolved Hide resolved
achhina force-pushed the GH-88597 branch 3 times, most recently from 81c6b06 to 99df7ef Compare November 14, 2022 09:23

sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Thank you!

I know that not all CLI entrypoints are tested, but I think we should start doing it. Especially because you have logic in your main, not just some other function call.

Comment thread Doc/library/uuid.rst Outdated Show resolved Hide resolved
Comment thread Doc/library/uuid.rst Outdated Show resolved Hide resolved
Comment thread Doc/library/uuid.rst Outdated Show resolved Hide resolved
Comment thread Doc/library/uuid.rst Outdated Show resolved Hide resolved
Comment thread Doc/library/uuid.rst Show resolved Hide resolved
Comment thread Lib/uuid.py Outdated Show resolved Hide resolved
achhina force-pushed the GH-88597 branch 2 times, most recently from 31edacd to cc423c8 Compare November 15, 2022 02:50
achhina closed this Nov 15, 2022
achhina reopened this Nov 15, 2022
achhina force-pushed the GH-88597 branch 2 times, most recently from a0416f1 to e7fa43b Compare November 15, 2022 07:20

achhina commented Nov 15, 2022

Copy link
Copy Markdown
Contributor Author

Hi @sobolevn, thanks for taking a look! I believe I've addressed all the comments, and have added in some unit tests. Would you be able to take a look again when you have time?

sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Thanks! Several more ideas / comments :)

I think this can also be added to whatsnew/3.12, because this feature is quite useful.

Comment thread Doc/library/uuid.rst Outdated Show resolved Hide resolved
Comment thread Doc/library/uuid.rst Outdated Show resolved Hide resolved
Comment thread Lib/test/test_uuid.py Outdated Show resolved Hide resolved
Comment thread Lib/uuid.py Outdated Show resolved Hide resolved

achhina commented Nov 16, 2022

Copy link
Copy Markdown
Contributor Author

Hi @sobolevn! I've tried to address all the comments you provided, would you be able to take another look?

sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

LGTM! But, this will require a core-dev acceptance as well.

gpshead commented Jan 22, 2023

Copy link
Copy Markdown
Member

thanks!

merwok commented Jan 22, 2023
edited
Loading

Copy link
Copy Markdown
Member

For next PRs to Python repos, please don’t force push, it makes reviews less nice (comments can lose context, github notifs don’t link to a useful page, etc). See https://devguide.python.org/getting-started/pull-request-lifecycle/index.html

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

6 participants

Footer

© 2026 GitHub, Inc.