Wrong Technology

Nitro v0.12 - live change handling

Until now, Nitro apps could only respond to button or menu clicks. v0.12 changes all that.

To know about changes to a component's input as soon as it happens, set live=True on that component. You can set this on more than one component.

Examples

Here's a spinbox with live=True.

speed = 42  # Starting value
while True:
speed = view(
box('Speed (km/h)', value=speed, live=True),
f'Your speed is {speed} km/h',
)

Another example, using a checkbox:

keep_signed_in = True
while True:
keep_signed_in = view(
box('Remember me', value=keep_signed_in, live=True),
"Keep me signed in." if keep_signed_in else "Don't keep me signed in.",
)

Same technique, with a dropdown menu:

choice = 'yellow'
while True:
choice = view(
box('Choose a color', mode='menu', value=choice, live=True,
options=['green', 'yellow', 'orange', 'red'],
),
f'You chose {choice}.'
)

No callbacks

If you're familiar with Nitro's API, you'll notice that the above examples retain the simplicity of Nitro's callback-free API. To listen to changes and respond, simply place your code inside a while loop. When you're done listening, break out of the while loop (not shown for brevity).

This new capability, combined with partial updates ("edits") makes it possible to author Nitro apps that are equivalent in power and performance to H2O Wave apps.

Next steps

Over the next few weeks, you'll see a lot more examples of Nitro in action, but there's a pile of work to be done first to beef up the breadth of available widgets. Nitro is actively being used to develop some exciting new capabilities in Driverless AI, so getting those features out takes priority over everything else for now.

Also, I spent some time organizing active/upcoming issues in our repo. There's now a backlog and milestones.

The next release, 0.13, will ship with incremental improvements to improving how wizards look and behave, including some new capabilities to help user onboarding and reduce short-term memory load.

View the full change log.

Happy hacking!

« Nitro in Web Assembly - Performance A Revertible Python dictionary »