Product Release
Published on October 4, 2022
Whether you are a data scientist, analyst, or researcher like me, interactive dashboards and visualization tools are critical to your success. After all, our work is only useful as long as we can share it with the end user.
Genie Framework has empowered the Julia language community with a highly productive, low-code toolset for building data apps with beautiful UIs. It has become the most popular app framework for Julia, with over 35k downloads in the last 12 months. Yet, many of our users are new to Julia and web development concepts, so they find the code too complex and the tutorials hard to follow.
So, today we’re taking a step towards making Genie Framework easier to use. We are releasing GenieFramework.jl 1.0. With this new meta-package, we have made it easier to work with the packages in the framework so that you can get your apps up and running faster than ever. Further, we have strengthened our commitment to improving and extending Genie Framework’s educational material.
Our team has been hard at work streamlining the API, which has resulted in the following major improvements:
@in
and @out
macros to expose individual variables to the UI. Restarting Julia on model changes is no longer necessary!Take a look at the example below to get an idea of how much easier the app-building process has become. The new macros make code easier to read, and the number of lines you’ll need to write has been reduced!
hellopie.jl
using Faker
using GenieFramework
@genietools
@handlers begin
@in number_of_slices = 3
@out piechart = PlotData(; values = [], labels = [], plot = "pie")
@onchangeany isready, number_of_slices begin
= PlotData(
piechart = rand(1:100, number_of_slices),
values = [Faker.first_name() for _ in 1:number_of_slices],
labels = "pie"
plot
)end
end
@page("/", "ui.jl")
isrunning() || Server.up() Server.
ui.jl
row([
cell(class="st-module", [
h6("Number of slices")
slider(1:1:20, :number_of_slices; label=true)
])
])
row([
cell(class="st-module", [
h5("Pie chart")
plot(:piechart)
]) ])
hellopie.jl
using Genie.Server
using Stipple
using Stipple.ModelStorage.Sessions
using StippleUI
using StipplePlotly
using Faker
using GenieAutoReload
autoreload(pwd())
GenieAutoReload.
@reactive mutable struct HelloPie <: ReactiveModel
::R{Int} = 3
number_of_slices::R{PlotData} = PlotData(; values = [], labels = [], plot = "pie")
piechartend
function handlers(model::HelloPie)
onany(model.isready, model.number_of_slices) do (_...)
= PlotData(
model.piechart[] = rand(1:100, model.number_of_slices[]),
values = [Faker.first_name() for _ in 1:model.number_of_slices[]],
labels = "pie"
plot
)end
modelend
function ui(model::HelloPie)
page(
model,
[heading("Hello pie!")
row([
cell(class="st-module", [
h6("Number of slices")
slider(1:1:20, :number_of_slices; label=true)
])
])
row([
cell(class="st-module", [
h5("Pie chart")
plot(:piechart)
])
])
],= [
append channels_support()
Genie.Assets.assets()
GenieAutoReload.
]
)end
route("/") do
|> init |> handlers |> ui |> html
HelloPie end
isrunning() || Server.up() Server.
To help you get started, we have written a new detailed tutorial for the example Iris Clustering app that can be found in this blog post.
If you need help or want to report issues, join our Discord or file an issue on GitHub. Lastly, we will soon bring you exciting news on Genie Builder. Stay tuned!