Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local dev: cache PyPI responses for one hour #164

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Sep 5, 2024

This helps local development. For the daily deploy, it won't matter, because the CI is a fresh environment and won't have the cache file (the 1-hour cache would have expired anyway).

It speeds up repeated runs from ~9 seconds to ~1 second.

First run:

make generate  1.76s user 0.70s system 27% cpu 8.865 total

Second run:

make generate  0.82s user 0.14s system 79% cpu 1.209 total

Delete requests-cache.sqlite to get a fresh batch.


Also add --number to generate.py for testing, in case you only want to fetch a few.

Finally, remove an unused import, and use math.tau directly (added in 3.6) instead of calculating 2 * math.pi.

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