cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Add command-line functionality to uuid module

Open f5fd3372-edc3-4555-813b-88415e4a7499 opened this issue 4 years ago • 4 comments

BPO 44431
Nosy @serhiy-storchaka, @erlend-aasland, @ephenix
PRs
  • python/cpython#26751
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-06-16.04:14:46.410>
    labels = ['type-feature', '3.11']
    title = 'Add command-line functionality to uuid module'
    updated_at = <Date 2021-06-16.22:06:09.458>
    user = 'https://github.com/ephenix'
    

    bugs.python.org fields:

    activity = <Date 2021-06-16.22:06:09.458>
    actor = 'erlendaasland'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2021-06-16.04:14:46.410>
    creator = 'ephenix'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44431
    keywords = ['patch']
    message_count = 2.0
    messages = ['395906', '395967']
    nosy_count = 3.0
    nosy_names = ['serhiy.storchaka', 'erlendaasland', 'ephenix']
    pr_nums = ['26751']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44431'
    versions = ['Python 3.11']
    

    Suggested functionality:

    python -m uuid b9aa5a06-e2cd-4c26-b26b-1590f01ea996

    I think it would be a useful feature.

    But would not be better to make interface similar to interface of standard Linux command uuidgen? In any case it should support the -h or --help options.

    serhiy-storchaka avatar Jun 16 '21 21:06 serhiy-storchaka

    @ephenix would you still like to work on this as I see you've closed your PR? If not, I'd like to work on this; I'll wait a couple of days to give you a chance to respond if you'd still like to continue.

    achhina avatar Nov 07 '22 05:11 achhina

    @ephenix would you still like to work on this as I see you've closed your PR? If not, I'd like to work on this; I'll wait a couple of days to give you a chance to respond if you'd still like to continue.

    I lost track of this -- feel free to take my pull request and do anything necessary to get it merged. IIRC the changes I made were working.

    ephenix avatar Nov 10 '22 06:11 ephenix

    thanks for the contribution.

    gpshead avatar Jan 22 '23 07:01 gpshead

    Thank you for your contribution @achhina. But I have few nitpicks:

    1. Most CLI tools on Unix and Linux use minus followed by a single letter as short options, and double minus followed by a sequence of letters as long option. An alternative style used in minority of commands (e.g. find and java) use single minus for long options. But your proposition mixes the styles: there are short options like -u, long options like --name, and also long option with a single minus -ns. argparse of course supports both styles, but I was surprised that it supports a mix, and I am not sure that it will not be broken in future (-ns can be interpreted as two separate options -n and -s).
    2. Standard Linux utility uuidgen has similar interface, but conflicting short options. -n is a short alias of --namespace, and -N is a short alias of --name. As you see option -n has different semantic.
    3. uuidgen accepts namespace argument in form: @dns @url @oid @x500. In your proposition it should be in form: NAMESPACE_DNS NAMESPACE_URL NAMESPACE_OID NAMESPACE_X500. And it is not documented.

    I propose to rename -n to -N and -ns to -n, and accept simpler compatible namespace syntax.

    serhiy-storchaka avatar Jan 22 '23 12:01 serhiy-storchaka

    @serhiy-storchaka that makes sense, I can create a follow-up patch in regards to the proposed changes if everyone agrees - cc @gpshead.

    achhina avatar Jan 22 '23 19:01 achhina

    Good thinking Serhiy, those changes makes sense to me.

    gpshead avatar Jan 22 '23 20:01 gpshead

    Just @ me on the PR when you've created one @achhina.

    gpshead avatar Jan 22 '23 20:01 gpshead

    thanks for the contribution!

    gpshead avatar Jan 25 '23 17:01 gpshead