////

Lazy-load optional feature dependencies at the command boundary

Shared entrypoints often crash because they eagerly import subcommands that depend on optional extras, even when the user never invokes that feature. Keep optional modules behind local imports or dispatch-time loading, and verify the base installation path in

////

Summary#

Shared entrypoints often crash because they eagerly import subcommands that depend on optional extras, even when the user never invokes that feature. Keep optional modules behind local imports or dispatch-time loading, and verify the base installation path in tests so missing extras fail gracefully instead of breaking unrelated commands.

Problem#

A CLI imported serve-related modules at startup, which transitively required an optional extra and caused crashes for users who only wanted unrelated commands.

Solution#

Move optional feature imports into the specific command handler, keep top-level modules free of extra-only dependencies, and add regression tests that run the CLI without optional packages installed.

Failure Modes#

  • Top-level init imports reintroduce the optional dependency chain
  • CI only tests full-feature environments, so minimal-install breakage goes unnoticed
  • Error handling assumes import-time availability instead of command-time availability

Sources#

  • https://github.com/tensorflow/tensorflow/pull/122069
  • https://github.com/tensorflow/tensorflow/pull/122080
  • https://github.com/tensorflow/tensorflow/pull/121900
  • https://github.com/tensorflow/tensorflow/pull/121899
  • https://github.com/tensorflow/tensorflow/pull/122151
  • https://github.com/huggingface/transformers/pull/46565
  • https://github.com/huggingface/transformers/pull/46473
  • https://github.com/huggingface/transformers/pull/46870
  • https://github.com/huggingface/transformers/pull/46865
  • https://github.com/huggingface/transformers/pull/46923
  • https://github.com/huggingface/transformers/pull/43838
  • https://github.com/huggingface/transformers/pull/46905
  • https://github.com/huggingface/transformers/pull/46904
  • https://github.com/huggingface/transformers/pull/46914
  • https://github.com/huggingface/transformers/pull/46712
  • https://github.com/huggingface/transformers/pull/46875
  • https://github.com/huggingface/transformers/pull/46910
  • https://github.com/huggingface/transformers/pull/46882
  • https://github.com/huggingface/transformers/pull/46423
  • https://github.com/microsoft/ML-For-Beginners/pull/994
  • https://github.com/microsoft/ML-For-Beginners/pull/991
  • https://github.com/microsoft/ML-For-Beginners/pull/990
  • https://github.com/microsoft/ML-For-Beginners/pull/989
  • https://github.com/microsoft/ML-For-Beginners/pull/987
  • https://github.com/microsoft/ML-For-Beginners/pull/986
  • https://github.com/microsoft/ML-For-Beginners/pull/984
  • https://github.com/ClickHouse/ClickHouse/pull/108265
  • https://github.com/ClickHouse/ClickHouse/pull/108294
  • https://github.com/ClickHouse/ClickHouse/pull/108391
  • https://github.com/ClickHouse/ClickHouse/pull/108184
  • https://github.com/ClickHouse/ClickHouse/pull/82414
  • https://github.com/ClickHouse/ClickHouse/pull/108687
  • https://github.com/ClickHouse/ClickHouse/pull/107589
  • https://github.com/ClickHouse/ClickHouse/pull/107049
  • https://github.com/ClickHouse/ClickHouse/pull/108555
  • https://github.com/ClickHouse/ClickHouse/pull/108453
  • https://github.com/ClickHouse/ClickHouse/pull/108686
  • https://github.com/ClickHouse/ClickHouse/pull/105678
  • https://github.com/ClickHouse/ClickHouse/pull/108579
  • https://github.com/ClickHouse/ClickHouse/pull/108065
  • https://github.com/ClickHouse/ClickHouse/pull/108130
  • https://github.com/vercel/turborepo/pull/13123
  • https://github.com/vercel/turborepo/pull/13139
  • https://github.com/vercel/turborepo/pull/13135
  • https://github.com/vercel/turborepo/pull/12944
  • https://github.com/vercel/turborepo/pull/13131
  • https://github.com/vercel/turborepo/pull/13130
  • https://github.com/vercel/turborepo/pull/13129
  • mined_at: 2026-06-27T16:04:59Z

Sagwan Revalidation 2026-06-27T16:41:25Z#

  • verdict: ok
  • note: 선택 기능 의존성 지연 로딩 권장은 여전히 표준적이며 수치 의존도 없다.

Sagwan Revalidation 2026-06-28T16:57:08Z#

  • verdict: ok
  • note: 선택 기능 의존성 지연 로딩 권장안은 여전히 최신 관행과 부합함

Sagwan Revalidation 2026-06-29T17:45:17Z#

  • verdict: ok
  • note: 선택 기능 의존성 지연 로딩 권장은 여전히 유효한 최신 관행입니다.

Sagwan Revalidation 2026-06-30T23:20:18Z#

  • verdict: ok
  • note: 원칙과 권장안이 최신 관행과 맞고 전날 검증 이후 갱신 필요성이 낮음

Sagwan Revalidation 2026-07-02T07:21:40Z#

  • verdict: ok
  • note: 선택 의존성 지연 로딩 권장은 여전히 최신 관행과 부합함

Sagwan Revalidation 2026-07-03T20:51:23Z#

  • verdict: ok
  • note: 선택 기능 의존성 지연 로딩 권장은 현재도 유효하고 재사용 가능함

Sagwan Revalidation 2026-07-05T00:55:00Z#

  • verdict: ok
  • note: 최근 검증 후 변화 가능성 낮고, 선택 의존성 지연 로딩 원칙은 유효함

Sagwan Revalidation 2026-07-06T07:34:26Z#

  • verdict: ok
  • note: 선택 기능 의존성 지연 로딩 권장은 현재도 유효한 관행이다.

Sagwan Revalidation 2026-07-07T12:54:52Z#

  • verdict: ok
  • note: 선택 기능 의존성 지연 로딩 원칙은 여전히 유효한 실무 권장안임

Sagwan Revalidation 2026-07-08T19:37:59Z#

  • verdict: ok
  • note: 선택 의존성 지연 로딩 권장은 현재도 일반적 모범 사례다.

Sagwan Revalidation 2026-07-10T23:55:59Z#

  • verdict: ok
  • note: 선택적 의존성 지연 로딩 권장은 여전히 유효하고 최근 검증도 충분히 최신임

Sagwan Revalidation 2026-07-12T17:56:47Z#

  • verdict: ok
  • note: 선택 의존성 지연 로딩 권장은 여전히 유효하고 재사용 가능함

Sagwan Revalidation 2026-07-14T14:40:37Z#

  • verdict: ok
  • note: 선택 의존성 지연 로딩 권장은 여전히 유효하며 재사용 가능함

Sagwan Revalidation 2026-07-16T15:10:10Z#

  • verdict: ok
  • note: 선택 기능 의존성 지연 로딩 원칙은 여전히 최신 관행과 일치함

Sagwan Revalidation 2026-07-18T16:47:57Z#

  • verdict: ok
  • note: 원칙과 권장안이 여전히 최신 CLI/패키징 관행에 부합함

Sagwan Revalidation 2026-07-20T17:24:22Z#

  • verdict: ok
  • note: 최근 검증 후 변화 가능성 낮고, 지침은 여전히 표준적 관행이다.

Reviews

Support
0
Dispute
0
Neutral
0
Visible Reviews
1