Skip to content

Clean up CLI streams/columns, add lazy package init, argcomplete, and cyan help (11.18.0) - #756

Merged
iskandr merged 1 commit into
mainfrom
feat/cli-polish-and-argcomplete
Nov 20, 2026
Merged

iskandr merged 1 commit into
mainfrom
feat/cli-polish-and-argcomplete

Conversation

@iskandr

@iskandr iskandr commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #432
Closes #697

1. Clean CLI output streams, tables, and unified CSV columns (#432)

  • Route varcode/cli/logging.conf handlers to sys.stderr with WARNING defaults for varcode, pyensembl, and datacache, and configure logging lazily inside main() after argument parsing.
  • Remove the pre-parse_args Varcode / Version / Path banner from effects_script.py and genes_script.py, and expose --version on varcode, varcode effects, varcode genes (varcode-genes), and varcode check-samples.
  • When --output-csv is omitted, write full unindexed aligned tables (on a TTY, with bold-cyan header row) or clean CSV (when piped/redirected) to stdout instead of logging truncated Python reprs.
  • Align varcode genes CLI CSV variant columns with varcode effects (contig, start, ref, alt with trimmed allele normalization, plus reference metadata columns).

2. Lazy PEP 562 package init (<50 ms startup), argcomplete, and cyan help styling (#697)

  • Convert varcode/__init__.py to PEP 562 __getattr__ lazy re-exports while keeping if TYPE_CHECKING: explicit imports for mypy (implicit_reexport = false) and mkdocstrings.
  • Defer heavy imports (pandas, numpy, pyensembl, orfdata, sample_identity) into CLI command handlers, reducing import argcomplete, varcode.cli.main from ~662 ms to ~45 ms (varcode-genes from ~503 ms to ~44 ms).
  • Add argcomplete>=3 to requirements.txt, add # PYTHON_ARGCOMPLETE_OK and argcomplete.autocomplete(...) to CLI entry modules, add varcode/cli/help.py matching the shared OpenVax single-hue cyan formatter, and document tab completion in README.md.
  • Add tests/test_cli_completion_and_output.py covering import-lightness, _ARGCOMPLETE=1 completions, TTY/NO_COLOR/TERM=dumb styling, stderr/stdout separation, and unified CSV columns.

Version

  • Bump varcode to 11.18.0.

… cyan help (11.18.0)

- Route CLI logging to stderr with WARNING defaults configured lazily after
  argument parsing, drop the pre-help Version/Path banner, expose --version on
  all subcommands, print full unindexed aligned tables (TTY) or CSV (piped) to
  stdout when --output-csv is omitted, and align `varcode genes` CLI CSV
  variant columns (`contig`, `start`, `ref`, `alt`, trimmed alleles) with
  `varcode effects` (#432).
- Convert `varcode/__init__.py` to PEP 562 lazy `__getattr__` re-exports
  (preserving `__all__` and static `TYPE_CHECKING` imports for mypy), defer
  heavy imports in CLI command modules so `varcode` and `varcode-genes` import
  in ~45 ms without loading pandas/numpy/pyarrow/pyensembl/orfdata, add
  `argcomplete>=3` tab completion with `# PYTHON_ARGCOMPLETE_OK`, and add
  shared single-hue cyan terminal help styling in `varcode/cli/help.py` (#697).
- Bump version to 11.18.0.

Closes #432
Closes #697
@iskandr
iskandr merged commit 0914eb5 into main Nov 20, 2026
6 checks passed
@iskandr
iskandr deleted the feat/cli-polish-and-argcomplete branch November 20, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant