Skip catalog loading for the version command#3146
Open
jx2lee wants to merge 1 commit intoapache:mainfrom
Open
Conversation
geruh
reviewed
Mar 13, 2026
Member
geruh
left a comment
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
pyiceberg versionshould print the installed PyIceberg version even when.pyiceberg.yamlor catalog-related environment variables are invalid. CLI group callback eagerly loads the catalog for every subcommand, soversioncan fail before it prints anything.This change skips catalog loading for the
versionsubcommand and adds a regression test for that behavior.Are these changes tested?
Yes.
test_version_does_not_load_catalogintests/cli/test_console.pyAre there any user-facing changes?
Yes.
pyiceberg versionnow prints the version without requiring valid catalog configuration.