Skip to content

Document import discipline for the CLI cold path - #40

Merged
KraHsu merged 1 commit into
feat/cli-interactive-completionfrom
docs/contributing-import-discipline
May 15, 2026
Merged

KraHsu merged 1 commit into
feat/cli-interactive-completionfrom
docs/contributing-import-discipline

Conversation

@KraHsu

@KraHsu KraHsu commented May 15, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #39. Adds an Import discipline section to CONTRIBUTING.md and its bilingual mirror docs/contributing.zh.md, locking in the convention introduced by the lazy-import work on genelab/__init__.py, genelab/utils/__init__.py, and genelab.configs.

The section spells out:

  • No eager import torch / Genesis from a top-level __init__.py.
  • The PEP 562 __getattr__ pattern for re-exports.
  • The quoted-annotation pattern in genelab.configs and the NameError-tolerant _field_annotation.

Goal: prevent a future PR from silently regressing the CLI cold path back to ~850 ms.

Test plan

Add an "Import discipline" section to CONTRIBUTING.md (and its bilingual
mirror in docs/contributing.zh.md) describing the constraint and the
PEP 562 __getattr__ pattern.

Locks in the convention introduced by the lazy-import work on
genelab/__init__.py, genelab/utils/__init__.py, and genelab.configs so
future re-exports do not re-introduce torch into the CLI cold path.
@KraHsu
KraHsu merged commit 2d5b617 into feat/cli-interactive-completion May 15, 2026
3 checks passed
@KraHsu
KraHsu deleted the docs/contributing-import-discipline branch May 18, 2026 12:01
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.

1 participant