marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
6.93k stars 246 forks source link

mo.ui.slider with very small step value does not work #2593

Open vangberg opened 2 weeks ago

vangberg commented 2 weeks ago

Describe the bug

If I create a slider with a step value of 10**-7 the slider does not respond. A step value of 10**-06 works fine.

https://github.com/user-attachments/assets/177b352c-8689-46f0-a926-043cda5133d1

Environment

{ "marimo": "0.9.6", "OS": "Darwin", "OS Version": "22.3.0", "Processor": "arm", "Python Version": "3.12.6", "Binaries": { "Browser": "129.0.6668.91", "Node": "v22.9.0" }, "Dependencies": { "click": "8.1.7", "importlib-resources": "missing", "jedi": "0.19.1", "markdown": "3.7", "pygments": "2.18.0", "pymdown-extensions": "10.10.1", "ruff": "0.6.7", "starlette": "0.39.0", "tomlkit": "0.13.2", "typing-extensions": "4.12.2", "uvicorn": "0.30.6", "websockets": "12.0" }, "Optional Dependencies": {} }

Code to reproduce

import marimo as mo

works = mo.ui.slider(10**-7, 10**-5, 10**-6, show_value=True)

fails = mo.ui.slider(10**-7, 10**-5, 10**-7, show_value=True)
mscolnick commented 2 weeks ago

This is coming from an upstream library and looking through their code, its likely a rounding issue.

The seemed to fix this for small numbers, but I am guessing not this small. https://github.com/radix-ui/primitives/issues/462 https://github.com/radix-ui/primitives/pull/463

mscolnick commented 2 weeks ago

we may have better luck switching to react-aria-components

https://react-spectrum.adobe.com/react-aria/Slider.html