marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.

Home Page:https://marimo.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support custom base URL paths, redux (for `marimo edit`)

jyio opened this issue · comments

commented

Description

TL;DR: Could marimo edit be used with a custom base URL path to enable remote access through a path-based reverse proxy?

Thank you for creating and sharing Marimo. Reactive Python is awesome!

Now, I'd love to integrate Marimo with the rest of my stack, including the path-based reverse proxy in JupyterHub (I know, I know...). Allowing custom base URL paths would enable remote access to Marimo through most HTTP reverse proxies. For example, a reverse proxy at example.com might make Marimo available under http(s)://example.com/path/to/marimo/, and Marimo would be configured to accept the /path/to/marimo/ prefix and generate all hyperlinks with the /path/to/marimo/ prefix.

It is already possible to use marimo run with a --base-url parameter to specify a path prefix, as implemented in #748. Adding similar functionality to marimo edit would make most (all?) of Marimo accessible through most reverse proxies.

Why JupyterHub in particular? Marimo is currently a single-tenant single-user app. Multiuser functionality would greatly amplify Marimo's utility, but requires a lot of work (and may even be out of scope of a notebook). JupyterHub could be used as a stop-gap measure to handle the authN/authZ, automatically spawn a Marimo instance for each user on demand, and even provide container-level isolation if desired. It would still be good to have a purpose-built Marimo-hub eventually, but JupyterHub compatibility would relieve the pressure in the near term (and I imagine it would go a long way).

Suggested solution

Give marimo edit the ability to accept a custom base URL (and generate all hyperlinks with the same prefix), similar to marimo run #748.

And, since the editor also supports notebook creation, also consider adding the feature to marimo new.

Alternative

Wait for the multiheaded Marimo-hub 😅

Additional context

No response

@jyio - i have the PR up #1651

I am not familiar with running my own JupyterHub - would you be open to contributing a "How To" doc running marimo with JupyterHub (once you have it all set up) that we can add to our docs. if easier, you can add it to this issue #905 and we can convert it to our docs

commented

This is awesome! Thank you! And... confirmed working with JupyterHub.

Yes of course I would write up the instructions. To make this a little easier, I'm looking into creating a convenience package that you could just pip install without having to mess with the jupyterhub_config.py. And, since JupyterHub is a bit of a beast, I'd want to create a minimal reproducible Dockerfile to set up this JupyterHub + Marimo combo. Coming soon :)

that would be awesome! let us know if you'd like to make it in the marimo-team org which could help with discoverability. otherwise, we can link our docs to the project

commented

Oh yeah, adopting this integration into marimo-team would definitely encourage people to try it more than "just install this random package from the internet," and I'm all for it. On the flip side, as you say, having another combination to test would add more speed bumps in the way of developer velocity, so I'd also be fine with leaving it in the wild until the team feels ready to take it on (and we'd make it clear that it's "unofficial" but it'd be good to have permission to use the Marimo name and logo). I'm easy to satisfy 😅