Skip to content

perf(cli): check PyPI for a newer release at most once a day - #223

Merged
andyland merged 1 commit into
mainfrom
lk/cache-version-check
Oct 29, 2026
Merged

andyland merged 1 commit into
mainfrom
lk/cache-version-check

Conversation

@lianakoleva

Copy link
Copy Markdown
Member

previously, the version check ran on every import of lightning_sdk, so every CLI command made a blocking request to pypi.org with no timeout. there was already per-process caching, but for CLI, this meant no caching. now, we store the outcome in ~/.lightning/version_check.json and reuse it for 24 hours. the cache is keyed by the installed version, so an upgrade triggers a fresh check. lightning-sdk typically gets released at most once a day, so we can safely check the version 1x/day.

demo: https://www.loom.com/share/7c175bf4911f48fa83908742b2be2c81

evidence

timing command (averaged over 5 runs): /usr/bin/time -p lightning --help

real user sys
before 0.70 0.41 0.11
before + LIGHTNING_DISABLE_VERSION_CHECK=1 0.57 0.34 0.11
after (cache write) 0.63 0.35 0.11
after (cache hit) 0.51 0.34 0.10

@lianakoleva lianakoleva changed the title fix(sdk): check PyPI for a newer release at most once a day perf(cli): check PyPI for a newer release at most once a day Oct 29, 2026
@lianakoleva
lianakoleva force-pushed the lk/cache-version-check branch from 1aa9d6e to 7cbe417 Compare October 29, 2026 19:55
@andyland
andyland enabled auto-merge (squash) October 29, 2026 20:54
@andyland
andyland merged commit c24ae5e into main Oct 29, 2026
24 checks passed
@andyland
andyland deleted the lk/cache-version-check branch October 29, 2026 21:05
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.

5 participants