Skip to content

Comments

refactor: explicit Config.load() + lazy catalog config initialization#3083

Draft
jx2lee wants to merge 2 commits intoapache:mainfrom
jx2lee:refactor-config
Draft

refactor: explicit Config.load() + lazy catalog config initialization#3083
jx2lee wants to merge 2 commits intoapache:mainfrom
jx2lee:refactor-config

Conversation

@jx2lee
Copy link
Contributor

@jx2lee jx2lee commented Feb 23, 2026

Closes #3028

Rationale for this change

This PR refactors config loading to avoid implicit IO and import-time config initialization.

Changes

  • Make Config() a pure container (no implicit file/env reads)
  • Add explicit Config.load() to load from config files + environment variables
  • Replace import-time _ENV_CONFIG with a lazy cached getter in pyiceberg.catalog
  • Update affected call sites to use Config.load() where runtime config reads are intended

Are these changes tested?

Yes!

Are there any user-facing changes?

No! (Maybe.. ?)

@jx2lee
Copy link
Contributor Author

jx2lee commented Feb 23, 2026

@kevinjqliu
I took a pass at a refactoring (a draft 🤗 ) based on your two concerns:

  1. Config() implicit IO (env + local config files)
  2. import-time _ENV_CONFIG initialization causing config reads during import

Direction I used is:

  • make Config() a pure container (no implicit)
  • add explicit Config.load() for file/env loading
  • replace import-time _ENV_CONFIG with a lazy cached getter used by load_catalog() / list_catalogs()

Would you mind taking a quick look and sharing any guidance on:

  • whether changing Config() semantics so config loading is explicit (e.g., via Config.load()) is acceptable in scope for this issue
  • any compatibility concerns I should watch for before opening a PR

Thanks — happy to adjust the approach based on your feedback. 👍🏽

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.

refactor Config() and _ENV_CONFIG

1 participant