Closed ankatiyar closed 2 weeks ago
Usage: kedro [OPTIONS] COMMAND [ARGS]... Try 'kedro -h' for help.
Error: No such option: -v
This is the stack trace when run kedro -V
, kedro -v
or kedro --version
While investgating this issue, I think it's worth checking why CI didn't catch this error, we have this test inplace.
def test_print_version(self):
"""Check that `kedro --version` and `kedro -V` outputs contain
the current package version."""
result = CliRunner().invoke(cli, ["--version"])
assert result.exit_code == 0
assert version in result.output
how to reproduce the error? the command works well for me
@DimedS kedro -V,r kedro --version
as mentioned. Are you using the main
branch? Can you copy the terminal log when you do kedro
?
I confirm kedro -V
and kedro --version
both give No such option
errors with 0.19.9
I figured out what the problem is: https://github.com/kedro-org/kedro/blob/a1fae5018f35243a5e49a54a9dd3223b2c4ea743/kedro/framework/cli/cli.py#L220
Due to the changes in lazy loading PR, I re-ordered the global commands list to consider
cli
which is the group with info
and the version_option
decorator global_commands
group which contains the new
and starter
lazy commands. So if any plugin with global commands (eg. Kedro-Viz) is installed in your env, the --version
option doesn't work. It works when you uninstall Kedro viz. Which is why it must be working in the CI and for @DimedS
The solution is simply to re-order the command groups to [cli, *load_entry_points("global"), global_commands]
but that would mean that users can't overwrite kedro info
which I think is acceptable.
Description
Reported by @noklam, since adding lazy loading of Kedro subcommands, the
--version
/-V
option isn't working.Context
This bug is originating in Kedro 0.19.7 -> https://github.com/kedro-org/kedro/pull/3883