Hello There
So i switched to shiny with python and craeed a somewhat bigger app whcih works great on my machine and i wanted to deploy it on shinyapps.io. But that does not work. I narrowed the problem to this example.
If i take the example from the introduction of shiny for python
and divide up the code to different files, one for ui and one for server (to have some view/controller seperation) and place them in the same directory all works fine and deployment to shinyapps works:
src +
app. py
example_server.py
example_ui.py
If i move the server and ui files to a package the trouble starts:
src +
app. py
example_package +
__init__.py
example_server.py
example_shiny.py
now the files look like this (especially the import statements):
app.py
from shiny import App
from example_package.example_server import example_server
from example_package.example_shiny import example_ui
# This is a shiny.App object. It must be named `app`.
app = App(example_ui, example_server)
example_server.py
import pandas as pd
from shiny import render
from io import StringIO
def example_server(input, output, session):
@output
@render.table
def parsed_data():
file_text = StringIO(input.csv_text())
data = pd.read_csv(file_text)
return data
example_shiny.py
from shiny import ui
example_ui = ui.page_fluid(
ui.input_text_area("csv_text", "CSV Text", value="a, b\n1, 2"),
ui.output_table("parsed_data"),
)
The app works on my machine but whene i upload it to shinyapp i get following output:
Validating server... [OK]
Validating app mode... [OK]
Making bundle ... [OK]
Deploying bundle ... [ERROR]: shinyapps reported an error (calling /v1/tasks/1284578595): Unhandled Exception: Child Task 1284578596 failed: Error parsing manifest: Bundle does not contain manifest file: example_package_init_.py
Error: shinyapps reported an error (calling /v1/tasks/1284578595): Unhandled Exception: Child Task 1284578596 failed: Error parsing manifest: Bundle does not contain manifest file: example_package_init_.py
So how does shinyapps create manifest files and what am i missing here?
I use Python 3.9.13, locally i use venv, my requirements.txt looks like this:
example_package
shiny~=0.2.10
pandas~=1.5.3
h11~=0.14.0
pip~=22.3.1
wheel~=0.38.4
Jinja2~=3.1.2
pytz~=2022.7.1
anyio~=3.6.2
sniffio~=1.3.0
contextvars~=2.4
mdurl~=0.1.2
numpy~=1.24.2
setuptools~=65.5.1
htmltools~=0.1.5
starlette~=0.26.1
click~=8.1.3
uvicorn~=0.21.1
websockets~=10.4
asgiref~=3.6.0
MarkupSafe~=2.1.2
python-dateutil~=2.8.2
six~=1.16.0
packaging~=23.0
python-multipart~=0.0.6
semver~=2.13.0
PyJWT~=2.6.0
immutables~=0.19
i created a manifest file with rsconnect. it looks good but the upload says it does not use it anyway.
Any help is apprechiated