Skip to content

refactor Config() and _ENV_CONFIG聽#3028

Description

@kevinjqliu

Apache Iceberg version

None

Please describe the bug 馃悶

Follow up to #3006, i want to see if we can refactor Config() and _ENV_CONFIG
a couple of issues ive seen

  • Config() __init__ reads both env vars and local config files implicitly, this can be a potentially footgun.
  • _ENV_CONFIG is loaded on import time... which calls Config() above and reads env vars and local config files.

#3006 is a fix for pytests. Ideally, I think we can be more explicit here

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time

Activity

  1. kevinjqliu commented on Mar 17, 2026

    @kevinjqliu
    ContributorAuthor

    Should_ENV_CONFIG even exist? its only used in load_catalog and list_catalogs

    If we want Config() to be cached, maybe it should be in config.py
    We should still make it lazy and not loaded automatically on import

    We might want to replace all calls to Config() in the codebase with the cached version, so that we wont need to re-parse everytime

  2. emecii commented on Sep 10, 2026

    @emecii

    I reviewed the agreed direction in #3083 and the follow-up #3208. Both PRs were closed automatically as stale and there is no open successor, so I prepared a narrow refreshed branch for the first slice: keep the existing Config() API, defer configuration-file and environment reads until the first config/get_* access, and cache the merged result per instance. It does not move _ENV_CONFIG or change the catalog-loading API.

    The branch is https://github.com/emecii/iceberg-python/tree/refactor/lazy-config-loading at 5586c286. On current main, the full unit target passes (4,019 passed, 3 skipped), as do make lint and Apache RAT on a clean worktree.

    @jx2lee @kevinjqliu, is it okay for me to open this narrow PR, or would you prefer the earlier work to be revived/continued instead?

    OpenAI Codex generated the patch, tests, and this comment and ran the reported checks. No human review is asserted.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions