Skip to content

feat(esptool): provision the 617 KiB source archive instead of the 82 MiB bundle - #1945

Merged
zackees merged 1 commit into
mainfrom
agent/esptool-source-install
Nov 7, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/esptool-source-install

Conversation

@zackees

@zackees zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member

Why

#1944: a cold fbuild install on a 10 Mbit link takes 5.81 min / 399 MB for
ESP32-S3. 82.5 MiB of that was the tool-esptoolpy PyInstaller bundle — 20% of the whole
first-time download, for a tool fbuild uses for exactly one elf2image call per image.

pioarduino already publishes the same esptool release as a 617 KiB source archive
(esptoolpy-v<ver>.zip → v<ver>/esptool.zip). fbuild has installed that archive in a private
uv tool environment for Windows since #1678 (some releases, e.g. 5.1.0, have no Windows binary at
all); this PR takes it on every host.

What changed

  • Esptool::select_source_url (new, extracted from from_metadata_url_for_host): the
    registry-shaped esptoolpy-v<version>.zip mapping is no longer gated on is_windows(). Every
    host gets the 617 KiB archive; anything else keeps the old standalone-binary path.
  • ensure_standalone_installed (new): the PyInstaller body of ensure_installed moved here
    unchanged.
  • ensure_installed: a failed source install on a host that has a standalone binary falls back
    to it with a warn! instead of failing the build. Windows keeps it fatal — there the source
    archive is the install.

Measured, not assumed (this host, real network)

source archive standalone bundle
download 617,641 B 82,508,446 B
installed tree 35 MB (uv env) 80 MB
elf2image (ESP32-S3 bootloader ELF, warm) 0.10 s 0.29–0.31 s
  • Byte-identical output: both paths produce sha256=3ef75dd1e480cfca… (18,720 B) for the same
    bootloader_dio_80m.elf. The Python entry point is also faster warm, because the PyInstaller
    one-file bundle unpacks ~217 MB on every invocation.
  • Cold install of the new path, end-to-end through ensure_installed (download → extract → uv tool install → version verify → locate launcher): 26.8 s, then 4.2 s warm on the re-run.
  • Projection: esptool drops from 82.5 MiB to ~12 MiB on the wire (0.6 MB archive + wheels) →
    ~331 MB / ~4.4 min at 10 Mbit, matching ESP32-S3 first-time install misses 4 min at 10 Mbit (5.81 min, 399 MB) #1944's own estimate for dropping the bundle. Reaching
    "under 4 min" still needs the 168 MB toolchain shrink, which is mirror-side (zstd single-chip
    slices) and out of scope here.

Tests

  • crates/fbuild-library/src/library/esptool_tests.rs: 33 pass (module), 333 pass for the
    whole crate lib (8 ignored).
    • registry_esptool_uses_published_source_archives — both 5.1.0 and 5.3.0 map to the source
      archive on every host (this is the assertion that used to require Windows).
    • standalone_fallback_is_permitted_only_where_a_binary_exists — both directions.
    • registry_url_with_an_unexpected_filename_keeps_the_standalone_path — the rewrite stays keyed
      on the exact esptoolpy-v<ver>.zip shape, so no guessed esptool.zip for a wrong version.
    • live_registry_source_install_provisions_a_runnable_esptool (#[ignore], needs network + uv)
      — the real end-to-end check above; run it with
      soldr cargo test -p fbuild-library --lib live_registry_source -- --ignored.
  • Mutations, each killed: restore the is_windows() gate → 2 URL tests fail; !windows → true →
    the fallback test fails.
  • soldr clippy -p fbuild-library --all-targets -- -D warnings clean, cargo fmt --check clean,
    platform boundary rows=44; dylint_rows=43 (unchanged), dylint allowlists current, test layout ok.

Not done

Closes nothing: #1944 still tracks the toolchain/MB target.

… MiB bundle

A cold install on a 10 Mbit link moved 399 MB, 82.5 MiB of it the
PyInstaller esptool bundle - 20% of the download for one elf2image call
per image (#1944). pioarduino publishes the same release as
a 617 KiB source archive, which fbuild already installs in a private uv
tool environment for Windows.

Every host now takes the source archive. A host that cannot build that
environment (no uv, no interpreter, no PyPI) falls back to the standalone
binary instead of failing the build; Windows keeps the failure fatal
because releases like 5.1.0 are source-only there.

Measured on a real ESP32-S3 bootloader ELF: byte-identical images
(sha256 3ef75dd1...), and elf2image is faster warm (0.10 s vs 0.29 s)
since the PyInstaller one-file bundle unpacks ~217 MB per invocation.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit ab98de1 Nov 7, 2026
31 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 8, 2026
@zackees
zackees deleted the agent/esptool-source-install branch November 24, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant