posit-dev / py-shiny

Shiny for Python
https://shiny.posit.co/py/
MIT License
1.3k stars 78 forks source link

not issue but asking if shiny can be used in future for mobile app? #608

Open ahmad-shahi opened 1 year ago

ahmad-shahi commented 1 year ago

can shiny be used for mobile app development in future? thanks for good work

PARKER-X commented 1 year ago

It's Sounds Interesting. If it's use for making mobile apps then that's great

gshotwell commented 1 year ago

I think this is possible but to my knowledge nobody has done it so far. While Shiny cannot be used to create native mobile apps which run on the phone's operating system, it should work as part of a progressive web application (PWA). These are mobile apps which look like regular applications but are really just web apps running in the browser. The benefit is that they're much easier to write and maintain, but since their running in the mobile browser they will be slower and some interactions won't be as snappy. With Shinylive you can run the entire shiny app on the client side so it should mean that you can run it as a PWA with no internet connection.

It might be as simple as packaging a shinylive web app with the right manifest file. It looks like Panel has a pwa helper method that generates the files so the same should work for Shiny.

Here's a good tutorial on Building progressive web apps

wch commented 1 year ago

In that past I did experiment with turning Shinylive apps into Progressive Web Apps. I believe I had the Wordle example working as an app on my Phone.

I only have a fuzzy memory of how to do it, but I think it basically involved creating a Shinylive app bundle (containing the HTML, JS, CSS, and wasm files) using the Python shinylive package (GitHub, PyPI), and then adding a manifest.json file.

For these web apps to work in completely offline mode, I believe it would require additional changes to Shinylive itself. I think the Service Worker JavaScript code would need to be modified to tell the browser cache more files than it currently does.