Page MenuHomeSoftware Heritage

Do not automagically add click cmd from swh.cli.subcommands
ClosedPublic

Authored by douardda on Sep 11 2020, 4:33 PM.

Details

Summary

the idea is now to be a bit more explicit, and expect thoses commands
to have the main swh click group as parent.

Then the swh.cli.subcommands entrypoint hooks only have to load the
declared cli modules.

So we now expect to:

  • use swh.core.cli.swh as parent group when declaring sub-groups/commands in a swh package.
  • the swh.cli.subcommand entrypoint to only refer the module rather than the click group/command, ie. have:

    ''' [swh.cli.subcommands] name = swh.path.to.cli_module '''

    instead of:

    ''' [swh.cli.subcommands] name = swh.path.to.cli_module:click_command '''

A backward compatilibility mech is provided: if the loaded entrypoint
object is indeed a click command, auto add it to the main swh group.

Event Timeline

Build has FAILED

Patch application report for D3930 (id=13853)

Rebasing onto 60c535ddee...

Current branch diff-target is up to date.
Changes applied before test
commit 94b6f081a140badfb82a6595ea821cb8d8b5647e
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Sep 11 16:24:23 2020 +0200

    Do not automagically add click cmd from swh.cli.subcommands
    
    the idea is now to be a bit more explicit, and expect thoses commands
    to have the main `swh` click group as parent.
    
    Then the swh.cli.subcommands entrypoint hooks only have to load the
    declared cli modules.
    
    So we now expect to:
    
    - use swh.core.cli.swh as parent group when declaring
      sub-groups/commands in a swh package.
    - the swh.cli.subcommand entrypoint to only refer the module rather than
      the click group/command, ie. have:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module
      '''
    
      instead of:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module:click_command
      '''
    
    A backward compatilibility mech is provided: if the loaded entrypoint
    object is indeed a click command, auto add it to the main swh group.

Link to build: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/40/
See console output for more information: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/40/console

Build is green

Patch application report for D3930 (id=13856)

Rebasing onto 60c535ddee...

Current branch diff-target is up to date.
Changes applied before test
commit c6f6634423793b5119b9ed784b958e94de3ddf57
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Sep 11 16:24:23 2020 +0200

    Do not automagically add click cmd from swh.cli.subcommands
    
    the idea is now to be a bit more explicit, and expect thoses commands
    to have the main `swh` click group as parent.
    
    Then the swh.cli.subcommands entrypoint hooks only have to load the
    declared cli modules.
    
    So we now expect to:
    
    - use swh.core.cli.swh as parent group when declaring
      sub-groups/commands in a swh package.
    - the swh.cli.subcommand entrypoint to only refer the module rather than
      the click group/command, ie. have:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module
      '''
    
      instead of:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module:click_command
      '''
    
    A backward compatilibility mech is provided: if the loaded entrypoint
    object is indeed a click command, auto add it to the main swh group.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/41/ for more details.

vlorentz added a subscriber: vlorentz.

I don't really understand what's going on here, but ok

swh/core/cli/__init__.py
119–124

you might want to explain why and/or how to fix it in a comment here

This revision is now accepted and ready to land.Sep 15 2020, 11:54 AM
swh/core/cli/__init__.py
119–124

TBH I have the fix for every concerned swh package waiting just behind, so...

swh/core/cli/__init__.py
119–124

okay, good

Build has FAILED

Patch application report for D3930 (id=14001)

Rebasing onto 6b983c28a3...

Current branch diff-target is up to date.
Changes applied before test
commit b1a9aa2a258ba126199fc79ffd0ab9f4a7bf351d
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Sep 11 16:24:23 2020 +0200

    Do not automagically add click cmd from swh.cli.subcommands
    
    the idea is now to be a bit more explicit, and expect thoses commands
    to have the main `swh` click group as parent.
    
    Then the swh.cli.subcommands entrypoint hooks only have to load the
    declared cli modules.
    
    So we now expect to:
    
    - use swh.core.cli.swh as parent group when declaring
      sub-groups/commands in a swh package.
    - the swh.cli.subcommand entrypoint to only refer the module rather than
      the click group/command, ie. have:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module
      '''
    
      instead of:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module:click_command
      '''
    
    A backward compatilibility mech is provided: if the loaded entrypoint
    object is indeed a click command, auto add it to the main swh group.

Link to build: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/58/
See console output for more information: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/58/console

Build has FAILED

Patch application report for D3930 (id=14008)

Rebasing onto ba8aa967ff...

Current branch diff-target is up to date.
Changes applied before test
commit 08b973a9cc5be8f4b77fcf532b860b904bcb47b5
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Sep 11 16:24:23 2020 +0200

    Do not automagically add click cmd from swh.cli.subcommands
    
    the idea is now to be a bit more explicit, and expect thoses commands
    to have the main `swh` click group as parent.
    
    Then the swh.cli.subcommands entrypoint hooks only have to load the
    declared cli modules.
    
    So we now expect to:
    
    - use swh.core.cli.swh as parent group when declaring
      sub-groups/commands in a swh package.
    - the swh.cli.subcommand entrypoint to only refer the module rather than
      the click group/command, ie. have:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module
      '''
    
      instead of:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module:click_command
      '''
    
    A backward compatilibility mech is provided: if the loaded entrypoint
    object is indeed a click command, auto add it to the main swh group.

Link to build: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/59/
See console output for more information: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/59/console

Build is green

Patch application report for D3930 (id=14009)

Rebasing onto ba8aa967ff...

Current branch diff-target is up to date.
Changes applied before test
commit ee0ae3c071391ddce76bd4d84117456b16511586
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Sep 11 16:24:23 2020 +0200

    Do not automagically add click cmd from swh.cli.subcommands
    
    the idea is now to be a bit more explicit, and expect thoses commands
    to have the main `swh` click group as parent.
    
    Then the swh.cli.subcommands entrypoint hooks only have to load the
    declared cli modules.
    
    So we now expect to:
    
    - use swh.core.cli.swh as parent group when declaring
      sub-groups/commands in a swh package.
    - the swh.cli.subcommand entrypoint to only refer the module rather than
      the click group/command, ie. have:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module
      '''
    
      instead of:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module:click_command
      '''
    
    A backward compatilibility mech is provided: if the loaded entrypoint
    object is indeed a click command, auto add it to the main swh group.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/60/ for more details.

Build is green

Patch application report for D3930 (id=14110)

Rebasing onto 56d505f34a...

Current branch diff-target is up to date.
Changes applied before test
commit 08788aa3783c6573325e05c8fb3ef6ebe53f894a
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Sep 11 16:24:23 2020 +0200

    Do not automagically add click cmd from swh.cli.subcommands
    
    the idea is now to be a bit more explicit, and expect thoses commands
    to have the main `swh` click group as parent.
    
    Then the swh.cli.subcommands entrypoint hooks only have to load the
    declared cli modules.
    
    So we now expect to:
    
    - use swh.core.cli.swh as parent group when declaring
      sub-groups/commands in a swh package.
    - the swh.cli.subcommand entrypoint to only refer the module rather than
      the click group/command, ie. have:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module
      '''
    
      instead of:
    
      '''
        [swh.cli.subcommands]
        name = swh.path.to.cli_module:click_command
      '''
    
    A backward compatilibility mech is provided: if the loaded entrypoint
    object is indeed a click command, auto add it to the main swh group.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/71/ for more details.