Skip to content

feat: modernize compression, script loading, and show; use JSON.jl - #66

Open
joshday wants to merge 28 commits into
masterfrom
jd/dev
Open

joshday wants to merge 28 commits into
masterfrom
jd/dev

Conversation

@joshday

@joshday joshday commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Compression: new settings.compression::Compression (on, min_length, float_types, rtol). Float arrays use the smallest type whose rounding error stays within rtol of the data's range (down to Float16); integers use the smallest JS integer type, and values beyond Int32 fall back to floats. String vectors are compressed as JSON.
  • No more zlib/npm dependencies: CodecZlib → Zlib_jll (zlib_compress), and the fflate npm package → the browser's built-in DecompressionStream. Decoding now works on pages that load require.js (Documenter, classic Jupyter) and in Pluto.
  • Script loading: plotly.js and other external scripts load once per page (in parallel, run in order) instead of one blocking <script src> per plot. A failed non-essential script (e.g. blocked MathJax) no longer blanks every plot.
  • Failure messages: a plot that can't draw shows why (JavaScript didn't run, plotly.js failed to load, or the error thrown) instead of an empty div.
  • Correctness: strings are JS-escaped for <script> (quotes, newlines and </script> no longer break plots); displaying a plot no longer consumes the global RNG.
  • Show: show(::Plot) and text/plain summarize traces instead of dumping data.
  • Dependencies: JSON3 → JSON.jl 1.x; Cobweb 0.7 only; version 0.14.0.
  • Org move cleanup (JuliaComputing → JuliaPlots): deploydocs repo; Docs builds only on v* tags; TagBot pushes tags with DEPLOY_KEY so releases publish versioned docs.
  • CI: macOS runs on aarch64; settings docs cover compression.

Developed with the help of Claude Code.

- html_div emits one `load_scripts` <script> that loads external scripts once
  per page; NewPlotScript awaits them instead of a <script src> per plot
- Compression settings struct: min_length, float_types, rtol
- Compressed arrays: IOContext-driven `json` methods, smallest JS typed array
  within rtol of the data range, strings as zlib'd JSON, browser decoding via
  DecompressionStream (drops fflate), zlib via Zlib_jll (drops CodecZlib)
- show(::Plot) summarizes traces instead of dumping data
- Cobweb compat 0.7 only
- CI: macOS on aarch64

Claude-Session: https://claude.ai/code/session_01XZMrvgy2C6ao6gFbfuhxQS
Take master's github-actions version bumps (#65); keep this branch's
Project.toml (Cobweb 0.7, Zlib_jll instead of CodecZlib).

Claude-Session: https://claude.ai/code/session_01XZMrvgy2C6ao6gFbfuhxQS
- json: JS-escape strings via JSON3 and write `<` as < so data can't
  close the surrounding <script>
- compress! only sets `on`; page_scripts adds the decoders whenever
  compression is on (no duplicates, works via settings/with_settings too)
- rand_id uses RandomDevice instead of the global RNG
- deploydocs repo -> JuliaPlots; Docs.yml only on v* tags; TagBot pushes
  tags with DEPLOY_KEY so they trigger the docs build
- Document settings.compression

Claude-Session: https://claude.ai/code/session_01XZMrvgy2C6ao6gFbfuhxQS
Plots used to render as an empty div when JavaScript was blocked, plotly.js
failed to load, or drawing threw.  The div now starts with a fallback note,
and the plot script replaces it with the failure reason (naming any script
that failed to load).

JSON3.jl is replaced by JSON.jl, its successor; schema keys are now Strings,
so trace-name propertynames convert to Symbol.

Claude-Session: https://claude.ai/code/session_01XZMrvgy2C6ao6gFbfuhxQS
@joshday joshday changed the title Modernizing compression and show methods feat: modernize compression, script loading, and show; use JSON.jl Sep 26, 2026
@joshday
joshday marked this pull request as draft September 28, 2026 10:55
@joshday
joshday marked this pull request as ready for review September 29, 2026 18:06
@jeremiedb

Copy link
Copy Markdown
Contributor

@joshday Were there pending blockers for having this PR merged? Removing deps on JSON3 for PlotlyLight (along EasyConfig JuliaComputing/EasyConfig.jl#12) would be great for ongoing compatibility considerations with the JSON/Parsers/CSV stack.

@joshday

joshday commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

No blockers! This just has more substantial changes than my last PR that I self-merged, so I wanted to give it some breathing room before merging

@joshday
joshday enabled auto-merge (squash) October 16, 2026 19:52
@joshday

joshday commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Automerge is enabled. This will merge as soon as I get windows nightly to go green

Comment thread Project.toml Resolved

This branch has not been deployed

No deployments
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.

2 participants