Docs PNGs compressed at commit
No docs build needs pngquant. Docs PNGs are compressed once, by a prek hook as they’re committed, instead of by
the optimize plugin on every CI build, which needs sudo apt-get install pngquant and so breaks the build
whenever the Ubuntu package mirrors are down, as on 2026-11-11.
Opportunistic: each repo gets it the next time it’s touched for a release anyway, as part of that work. No PRs for this alone, and no chasing repos that aren’t otherwise changing.
The change, per repo
Section titled “The change, per repo”As done in camera_autonotify (the first, 2026-11-11):
- Add
docgen/optimize_png.py, copied from camera_autonotify. It runs pngquant with theoptimizeplugin’s own settings (--force --skip-if-larger --speed 3 --strip), in place, and treats “left alone” (exit 98/99) as success, so committing an already compressed PNG changes nothing. - Add the hook to
.pre-commit-config.yaml, scoped todocs/so brand icons Home Assistant shows aren’t recompressed:- repo: localhooks:- id: optimize-pngname: optimize PNGsentry: python docgen/optimize_png.pylanguage: pythonadditional_dependencies: [pngquant-cli==3.0.3]types: [png]files: ^docs/pngquant-cliships prebuilt pngquant binaries (macOS, Linux x86_64, Windows), so neither Homebrew nor apt is needed. - Run it once over the existing images (
prek run optimize-png --all-files) and commit them. - Remove
- optimizefromproperdocs.yml,sudo apt-get install pngquantfrom the docs workflow, and thepngquantpackage from thedocsdependency group if it’s there (a Python wrapper nothing uses). - Check
properdocs buildworks with no pngquant onPATH.
- @pair camera_autonotify (2026-11-11), pending its first green CI run
- @pair anpr2mqtt
- @pair appliance_autonotify
- @pair autoarm
- @pair remote_logger
- @pair supernotify
- @pair updates2mqtt
- @pair signalk-cli
- @pair homeassistant-repl: only step 4’s
apt-getline, since it installs pngquant without usingoptimize - @agent Once two repos are done and green, add the rule to
policies/docs_toolchain.mdandproject_standards.md, so new repos start this way, then move this project todone/
Decisions
Section titled “Decisions”- 2026-11-11 jeyrb: opportunistic, done as each repo is next touched and released, not for its own sake.
- 2026-11-11: started from camera_autonotify’s docs build failing on the Ubuntu mirrors. Its four docs PNGs went
from 35.7 KB to 15.0 KB, the same as the
optimizeplugin made them in the built site, and a second hook run changes nothing. Survey of local checkouts: 7 repos useoptimizeand install pngquant in CI, and homeassistant-repl installs it without using it.