Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kedro --version isn't working #4296

Closed
ankatiyar opened this issue Nov 4, 2024 · 6 comments · Fixed by #4299
Closed

kedro --version isn't working #4296

ankatiyar opened this issue Nov 4, 2024 · 6 comments · Fixed by #4299
Labels
Issue: Bug Report 🐞 Bug that needs to be fixed

Comments

@ankatiyar
Copy link
Contributor

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 -> #3883

@ankatiyar ankatiyar added the Issue: Bug Report 🐞 Bug that needs to be fixed label Nov 4, 2024
@noklam
Copy link
Contributor

noklam commented Nov 4, 2024

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

@noklam
Copy link
Contributor

noklam commented Nov 4, 2024

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

@DimedS
Copy link
Member

DimedS commented Nov 4, 2024

how to reproduce the error? the command works well for me

@noklam
Copy link
Contributor

noklam commented Nov 4, 2024

@DimedS kedro -V,r kedro --version as mentioned. Are you using the main branch? Can you copy the terminal log when you do kedro?

@astrojuanlu
Copy link
Member

I confirm kedro -V and kedro --version both give No such option errors with 0.19.9

@ankatiyar
Copy link
Contributor Author

ankatiyar commented Nov 5, 2024

I figured out what the problem is:

return [*load_entry_points("global"), cli, global_commands]

Due to the changes in lazy loading PR, I re-ordered the global commands list to consider

  • first the commands loaded from plugins,
  • then cli which is the group with info and the version_option decorator
  • and then the 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Bug Report 🐞 Bug that needs to be fixed
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants