Skip to content

Add Observables.jl / Makie compatibility extension - #68

Merged
bvdmitri merged 3 commits into
mainfrom
feature/observables-makie-compat
Jun 17, 2026
Merged

Add Observables.jl / Makie compatibility extension#68
bvdmitri merged 3 commits into
mainfrom
feature/observables-makie-compat

Conversation

@bvdmitri

Copy link
Copy Markdown
Member

Summary

Adds RocketObservablesExt, a package extension that loads automatically when both Rocket and Observables are available (Julia ≥ 1.9) and provides a bidirectional compatibility layer between Rocket.jl and Observables.jl — the reactive primitive behind the Makie ecosystem.

Per the package-extension rules, the layer only adds methods to functions that already exist in either package (extensions cannot export new names). It works through two existing entry points:

  • Rocket → Makie — overloads the Observables.Observable constructor:
    • Observable(behaviorsubject) / Observable(recentsubject) seed from the subject's current/recent value.
    • Observable(initial, source) is the generic form for any subscribable, subject, or operator pipeline.
    • A small NextActor forwards each Rocket emission into the Observable (observable[] = value), firing Makie's listeners. The Rocket subscription's lifetime is tied to the Observable via a finalizer.
  • Makie → Rocketas_subscribable + on_subscribe! make any Observables.AbstractObservable a valid Rocket source, so subscribe! and the full operator catalogue (map, filter, …) work directly on Makie observables. The current value is emitted immediately on subscription (mirroring BehaviorSubject semantics); teardown detaches the listener via Observables.off.

Is it a true drop-in?

Yes, with one explicit Observable(source) conversion — not a literal pass-through. Makie gates reactivity on isa(x, Observables.AbstractObservable), which a Rocket type can't satisfy (the abstract type lives in a weak dependency). Converting to a genuine Observable is the robust path and is exactly what the extension mechanism allows.

Changes

  • ext/RocketObservablesExt.jl — the compatibility layer (methods only).
  • Project.toml[weakdeps], [extensions], Observables compat, and test extras/target.
  • docs/src/integrations/observables.md (registered in make.jl) — a comparison section plus executed-in-CI Rocket→Makie and Makie→Rocket examples. Adds CairoMakie + Observables to the docs environment.
  • test/ext/observables.jl (+ runtests.jl) — covers both directions and teardown, guarded for Julia ≥ 1.9.

Verification

  • Full test suite passes (12256 tests, including the new extension tests).
  • Strict docs build (warnonly = false) succeeds; both Makie figures render as PNG.

🤖 Generated with Claude Code

bvdmitri and others added 2 commits June 17, 2026 16:36
Introduce `RocketObservablesExt`, a package extension that loads
automatically when both Rocket and Observables are available (Julia >= 1.9)
and provides a bidirectional bridge between the two libraries:

- Rocket source -> `Observables.Observable` via the overloaded
  `Observable(source)` / `Observable(initial, source)` constructor, so a
  Rocket subject or operator pipeline can drive a Makie plot.
- `Observables.AbstractObservable` -> a valid Rocket subscribable, so
  `subscribe!` and the full operator catalogue work directly on Makie
  observables.

Per the extension rules, only methods on existing functions are added
(no new exported names). Adds a docs page comparing both libraries with
executed Rocket->Makie and Makie->Rocket examples, plus tests covering
both directions and teardown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.40%. Comparing base (0b09967) to head (b9c4505).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   78.20%   78.40%   +0.19%     
==========================================
  Files         119      120       +1     
  Lines        3799     3829      +30     
==========================================
+ Hits         2971     3002      +31     
+ Misses        828      827       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Observables 0.5 is not installable on Julia 1.3-1.5, and since it is a
test-target dependency Pkg.test failed at resolution on those versions
(before the VERSION >= 1.9 guard could skip the extension tests).
Allow 0.4 as well so old Julia resolves a compatible-but-unused version,
while Julia >= 1.6 still selects 0.5 for the extension.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bvdmitri
bvdmitri merged commit 2d6ffdf into main Jun 17, 2026
16 checks passed
@bvdmitri
bvdmitri deleted the feature/observables-makie-compat branch June 17, 2026 17:17
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