Details
- Reviewers
olasd - Group Reviewers
Reviewers - Commits
- rDCORE19b1bece67a3: cli: add a generic main 'swh' command
Diff Detail
- Repository
- rDCORE Foundations and core functionalities
- Branch
- current
- Lint
Lint Skipped - Unit
Unit Tests Skipped - Build Status
Buildable 5524 Build 7509: tox-on-jenkins Jenkins Build 7508: arc lint + arc unit
Event Timeline
Build is green
See https://jenkins.softwareheritage.org/job/DCORE/job/tox/203/ for more details.
swh/core/cli/__init__.py | ||
---|---|---|
31–35 | Do we really need the dict here? If so, would you mind adding a comment as to how/where it's being used in addition to the noqa? (and if not, I guess we can just flip around the for loop) |
swh/core/cli/__init__.py | ||
---|---|---|
31–35 | we probably do not need to keep this dict, but we need to ensure packages are loaded. Let me check this. |
So, from what I understand, the subcommand name is set by the name of the function in the plugin, when the swh.command() decorator is called.
I think it would be less surprising, if the entry points were used to actually define which functions are to be decorated, and the subcommand name.
So your entry point definition could be
[swh.cli.subcommands] db-init=swh.core.cli.db:db_init
And you could make the main or swh command lazy-load and decorate the proper function at runtime.
Does that make sense?
setup.py | ||
---|---|---|
57 | swh.cli.subcommands would certainly be more explicit ? | |
58 | Useless use of swh-? :) |
Build is green
See https://jenkins.softwareheritage.org/job/DCORE/job/tox/209/ for more details.
Implement the entrypoint loading mechanism using functions instead of modules
as suggested by olasd. This does not implement any generic lazy loading
magic stuff for now.
Build is green
See https://jenkins.softwareheritage.org/job/DCORE/job/tox/210/ for more details.
include forgotten patch: add log_level to 'swh' context obj
so subcommands can do specific stuff with current log level if needed.
See swh/core/cli/__init__.py:26
Build is green
See https://jenkins.softwareheritage.org/job/DCORE/job/tox/212/ for more details.