Skip to content

Skip catalog loading for the version command#3146

Open
jx2lee wants to merge 1 commit intoapache:mainfrom
jx2lee:jx2lee/skip-loadcatalog-when-version
Open

Skip catalog loading for the version command#3146
jx2lee wants to merge 1 commit intoapache:mainfrom
jx2lee:jx2lee/skip-loadcatalog-when-version

Conversation

@jx2lee
Copy link
Contributor

@jx2lee jx2lee commented Mar 13, 2026

Rationale for this change

pyiceberg version should print the installed PyIceberg version even when .pyiceberg.yaml or catalog-related environment variables are invalid. CLI group callback eagerly loads the catalog for every subcommand, so version can fail before it prints anything.

This change skips catalog loading for the version subcommand and adds a regression test for that behavior.

Are these changes tested?

Yes.

  • Added test_version_does_not_load_catalog in tests/cli/test_console.py

Are there any user-facing changes?

Yes.

  • pyiceberg version now prints the version without requiring valid catalog configuration.

@jx2lee jx2lee marked this pull request as ready for review March 13, 2026 11:21
Copy link
Member

@geruh geruh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jx2lee thanks for raising this. I think it makes sense to fix because a version sub command is a standard check. I took a quick pass at this and it seems like this is scoped down to missing and misconfiguration catlog setups as you mentioned.

But this also got me thinking, most users today are used to first running x --version from the cli. By moving to use clicks' click.version_option we can enable pyiceberg --version and wouldn't have to account for it in the sub commands.

Also, it's worth mentioning that a user running the --version command today will get:

> pyiceberg --version

Error: No such option: --version. Did you mean --verbose? 

But kind of thinking out loud here as this is small lol.

cc: @kevinjqliu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants