widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.6k stars 104 forks source link

Multipage as package - stripping of prefix not working #612

Closed johannesWen closed 2 weeks ago

johannesWen commented 2 weeks ago

Hi,

I have deployed my solara app as a python package with the following structure:

grafik

So I want to order the pages by the prefix and then use the rest of the folder name for the URL and Tab names, but unfortunately it is not working properly.

grafik

So maybe this is a bug, or I miss something. I have also attached the sample multipage solara app. Thank you for your help 😃

multipage_example.zip

maartenbreddels commented 2 weeks ago

Hi Johannes,

I am starting to think we should advise to start doing multipage like this:

import solara
from . import bar, foo

@solara.component
def Home():
    solara.Markdown("Foo")

routes = [
    solara.Route("/", component=Home, label="Home"),
    solara.Route("bar", component=bar.Page, label="Bar"),
    solara.Route("foo", component=foo.Page, label="Foo"),
]

It's very explicit, it's more clear what the order is, and there is less magic going on. What do you think?

cheers,

Maarten

johannesWen commented 2 weeks ago

Hi Maarten,

thank you for the tip with the routes! Yeah, I like it, to have more control about what is happening 😉

BR, Johannes