Skip to content

Conversation

@neilcampbell
Copy link
Contributor

Each time LocalNet is started or reset, a number of http calls would be made to the docker hub to check if any new docker image versions are available. New versions are generally released infrequently, so most of the time this check is not needed and slows the start/reset time of LocalNet.

This PR reduces the frequency of calls to check for new docker image versions, so that start/reset time is faster.
Based on some rudimentary tests, the following results were observed:

Starting without existing containers - algokit localnet start
Baseline: 10.51s (average)
Without version check: 7.82s (average)
≈ 25% improvement

Starting with existing containers - algokit localnet start
Baseline: 3.767s (average)
Without version check: 1.845s (average)
≈ 51% improvement

Resetting - algokit localnet reset
Baseline: 13.674s (average)
Without version check: 11.304s (average)
≈ 17% improvement

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit
   __init__.py15753%6–13, 17–24, 32–34
   __main__.py440%1–6
src/algokit/cli
   __init__.py47394%31–34
   codespace.py50982%28, 114, 137, 150–155
   completions.py108992%63–64, 83, 93–99
   dispenser.py121199%77
   doctor.py90693%159, 171–173, 202–203
   explore.py691775%35–40, 42–47, 85–92, 115–116, 121
   generate.py78890%76–77, 169, 178–179, 182–183, 186
   goal.py54689%67, 85, 96, 107–109
   localnet.py1693281%75, 96–123, 175–179, 223, 245, 260–270, 284, 337, 358–359
   task.py34391%25–28
src/algokit/cli/common
   utils.py37295%137, 139
src/algokit/cli/compilers
   typescript.py28196%59
src/algokit/cli/init
   command.py2672491%315–316, 321–322, 325, 346, 349–351, 362, 366, 424, 450, 479, 512, 521–523, 526–531, 544, 563, 575–576
   helpers.py37197%47
src/algokit/cli/project
   __init__.py23196%31
   bootstrap.py40198%35
   deploy.py1172083%47, 49, 102, 125, 147–149, 270, 277, 291–299, 302–311
   link.py811285%60, 65–66, 110–115, 143–144, 213–214, 218
   list.py33585%21–23, 51–56
   run.py46296%38, 174
src/algokit/cli/tasks
   analyze.py81199%81
   assets.py841385%70–71, 77, 79–80, 110, 125, 135–136, 144, 146, 148–149
   ipfs.py51884%52, 80, 92, 94–95, 105–107
   mint.py1061586%51, 73, 100–103, 108, 113, 131–132, 158, 335–339
   send_transaction.py661183%18, 54–55, 59, 91, 160, 172–176
   sign_transaction.py59886%21, 28–30, 71–72, 109, 123
   transfer.py35197%80
   utils.py1144660%24–32, 38–41, 73–74, 98–99, 123–131, 150–160, 207, 256–257, 277–288, 295–297, 319
   vanity_address.py561082%41, 45–48, 112, 114, 121–123
   wallet.py79495%21, 66, 136, 162
src/algokit/cli/tui/init
   example_selector.py17382%29–30, 34
src/algokit/cli/tui/init/screens
   example_selector_screen.py311455%12, 32–35, 38–51, 56–59
src/algokit/core
   codespace.py1756861%34–37, 41–44, 48–71, 111–112, 125–133, 191, 200–202, 210, 216–217, 229–236, 251–298, 311–313, 338–344, 348, 395
   conf.py57984%12, 24, 28, 36, 38, 73–75, 80
   dispenser.py2022687%92, 124–125, 142–150, 192–193, 199–201, 219–220, 260–261, 319, 333–335, 346–347, 357, 370, 385
   doctor.py65789%67–69, 92–94, 134
   generate.py50394%44, 85, 103
   goal.py65494%21, 36–37, 47
   init.py1215158%62, 66–71, 79, 88, 95, 121–122, 141–142, 147–171, 176–201, 214–225
   log_handlers.py68790%50–51, 63, 112–116, 125
   proc.py45198%100
   sandbox.py3313091%34, 91–94, 99, 103–105, 178, 228–235, 246, 303, 361–362, 389–390, 718, 734, 749–751, 767
   typed_client_generation.py2445080%84–86, 136, 169–174, 178–207, 231, 234–237, 255, 258–261, 321–332, 346, 352, 355–358
   utils.py1725369%25–27, 46, 65–66, 72–84, 140–146, 170, 173, 179–192, 221–223, 252–255, 275, 294–304
src/algokit/core/_vendor/auth0/authentication
   token_verifier.py15711129%16, 45, 58, 73–85, 98–107, 119–124, 136–137, 140, 170, 178–180, 190–199, 206–213, 227–236, 258, 280–287, 314–323, 333–444
src/algokit/core/compilers
   python.py28582%19–20, 25, 49–50
   typescript.py461078%26, 32, 35–38, 78–79, 88–89
src/algokit/core/config_commands
   container_engine.py412149%24, 29–31, 47–76
   js_package_manager.py361169%30–33, 38, 49–59
   py_package_manager.py361169%30–33, 38, 49–59
   version_prompt.py921485%37–38, 68, 87–90, 108, 118–125, 148
src/algokit/core/project
   __init__.py53394%50, 86, 145
   bootstrap.py3175583%14, 68, 75–77, 85–87, 92–93, 137, 146, 174–186, 228, 241–242, 294, 351, 430–431, 453, 480, 532–533, 539–545, 572–598, 615, 627–633, 645–647
   deploy.py69987%108–111, 120–122, 126, 131
   run.py1321390%83, 88, 97–98, 133–134, 138–139, 143, 147, 277–278, 293
src/algokit/core/tasks
   analyze.py93397%105–112, 187
   ipfs.py63789%58–64, 140, 144, 146, 152
   nfd.py491373%25, 31, 34–41, 70–72, 99–101
   vanity_address.py903462%49–50, 54, 59–75, 92–108, 128–131
   wallet.py71593%37, 129, 155–157
src/algokit/core/tasks/mint
   mint.py74988%123–133
   models.py921782%50, 52, 57, 71–74, 81–90
TOTAL566496883% 

Tests Skipped Failures Errors Time
594 0 💤 0 ❌ 0 🔥 48.667s ⏱️

Copy link
Contributor

@lempira lempira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement!
It looks like localnet --update will override the image cache and pull the lates but there doesn't seem to be a way to check if the cache is outdated within the TTL (a week). What about adding another localnet command like algokit localnet check that will just run the check and compare it against the cache? Alternatively, there could be a --check flag that will perform the check on that command. So algokit localnet start --check will start localnet but warn if there are new images. It would also work on localnet status --check

@neilcampbell
Copy link
Contributor Author

neilcampbell commented Dec 8, 2025

It looks like localnet --update will override the image cache and pull the lates but there doesn't seem to be a way to check if the cache is outdated within the TTL (a week). What about adding another localnet command like algokit localnet check that will just run the check and compare it against the cache? Alternatively, there could be a --check flag that will perform the check on that command. So algokit localnet start --check will start localnet but warn if there are new images. It would also work on localnet status --check

@lempira Good idea, will add that now.

@neilcampbell neilcampbell force-pushed the feat/faster-localnet-start-reset branch from 592ea1a to 0f6183a Compare December 8, 2025 06: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.

3 participants