Page MenuHomeSoftware Heritage

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

Authored by douardda on Fri, Sep 11, 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.

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

douardda created this revision.Fri, Sep 11, 4:33 PM

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

douardda updated this revision to Diff 13856.Fri, Sep 11, 5:20 PM

fix db/test_cli

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 accepted this revision.Tue, Sep 15, 11:54 AM
vlorentz added a subscriber: vlorentz.

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

swh/core/cli/__init__.py
122–127

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.Tue, Sep 15, 11:54 AM
douardda added inline comments.Thu, Sep 17, 12:05 PM
swh/core/cli/__init__.py
122–127

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

vlorentz added inline comments.Thu, Sep 17, 12:21 PM
swh/core/cli/__init__.py
122–127

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

douardda updated this revision to Diff 14009.Thu, Sep 17, 2:28 PM

fix db/test_cli

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.