-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use Widget()
inside Shiny
#30
Comments
Sorry not an avid shiny user... can you please provide a minimum reproducible example for how to setup an environment and run this code? EDIT: I can reproduce with the following: python3 -m venv .venv
source .venv/bin/activate
pip install shiny shinywidgets quak polars
shiny run app.py |
Oh interesting, I also get a similar error when running a hello mosaic-widget example: import pandas as pd
from mosaic_widget import MosaicWidget
import shiny.express
from shinywidgets import render_widget
import yaml
weather = pd.read_csv(
"https://uwdata.github.io/mosaic-datasets/data/seattle-weather.csv",
parse_dates=["date"],
)
# Load weather spec, remove data key to ensure load from Pandas
with open("weather.yaml") as f:
spec = yaml.safe_load(f)
_ = spec.pop("data")
@render_widget
def _():
return MosaicWidget(spec, data={"weather": weather}) |
This sniffs of some runtime global inspection by arrow (or one of this dependencies). I'm guessing Shiny includes a dep that sets a global (e.g., |
Ohh, yea, that seems likely. |
Just speculation. Don't know if that's it alone. I know that |
Ah, wait.... I'm being silly. I meant to bring this up later.
EDIT: shinywidgets does support binary data (although through base64 encoding), but the decoded binary blobs are |
I'm going to close. Feel free to re-open if there is an issue |
Ahh, nice catch, thank you! |
Hmm I've gotten lonboard to work in shiny widgets I think |
@kylebarron You are right. I dug in and shinywidgets comm impl base64 encodes the binary stuff. However, I’m guessing your handling of buffers is more flexible than arrow. something like new Uint8Array(x) would cast the data. |
I just took a quick look into rendering
quak.Widget()
in Shiny, and I get the following JS error:What's interesting here is that
./lib/widget.ts
's import ofapache-arrow
appears to work for stuff underipc/*
, but not for this line ofio/stream.ts
. Any idea why that might be?The text was updated successfully, but these errors were encountered: