#10407 feat: Use lazy imports in the Meltano CLI (Python 3.15+)
Pull request opened by
edgarrmondragon
Description
$ hyperfine \
--warmup 3 --min-runs 20 \
-n "No Lazy" --prepare 'uv venv -c -p 3.14 .venv && uv pip install --python .venv/bin/python .' ".venv/bin/meltano --help" \
-n "Lazy" --prepare 'uv venv -c -p 3.15 .venv && uv pip install --python .venv/bin/python .' ".venv/bin/meltano --help"
Benchmark 1: No Lazy (20 runs)
mean ± σ min … max
Wall Time [s] 5.183 ± 0.238 4.859 … 5.731
Memory [MiB] 115.5 ± 3.5 106.6 … 120.6
Benchmark 2: Lazy (20 runs)
mean ± σ min … max
Wall Time [s] 4.234 ± 0.163 3.969 … 4.508 -18.3%
Memory [MiB] 107.1 ± 3.3 101.5 … 112.8 -7.3%
Checklist
• I have read the
contribution guide
Was generative AI tooling used to co-author this PR?
No
Related Issues
• Closes #XXXX
Summary by Sourcery
Improve Meltano CLI startup performance by enabling lazy imports on Python 3.15 and newer.
New Features:
• Enable lazy loading of CLI and supporting modules on Python 3.15+ to reduce startup resource usage.
Enhancements:
• Apply lazy-import configuration across Meltano CLI commands and utilities.
• Update state command tests to resolve lazy imports before autospeccing and verify the returned state service.
meltano/meltano