Add Observables.jl / Makie compatibility extension - #68
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
RocketObservablesExt, a package extension that loads automatically when bothRocketandObservablesare 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:
Observables.Observableconstructor: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.NextActorforwards each Rocket emission into the Observable (observable[] = value), firing Makie's listeners. The Rocket subscription's lifetime is tied to the Observable via afinalizer.as_subscribable+on_subscribe!make anyObservables.AbstractObservablea valid Rocket source, sosubscribe!and the full operator catalogue (map,filter, …) work directly on Makie observables. The current value is emitted immediately on subscription (mirroringBehaviorSubjectsemantics); teardown detaches the listener viaObservables.off.Is it a true drop-in?
Yes, with one explicit
Observable(source)conversion — not a literal pass-through. Makie gates reactivity onisa(x, Observables.AbstractObservable), which a Rocket type can't satisfy (the abstract type lives in a weak dependency). Converting to a genuineObservableis the robust path and is exactly what the extension mechanism allows.Changes
ext/RocketObservablesExt.jl— the compatibility layer (methods only).Project.toml—[weakdeps],[extensions],Observablescompat, and test extras/target.docs/src/integrations/observables.md(registered inmake.jl) — a comparison section plus executed-in-CI Rocket→Makie and Makie→Rocket examples. AddsCairoMakie+Observablesto the docs environment.test/ext/observables.jl(+runtests.jl) — covers both directions and teardown, guarded for Julia ≥ 1.9.Verification
warnonly = false) succeeds; both Makie figures render as PNG.🤖 Generated with Claude Code