marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.39k stars 158 forks source link

Plots return 404 when using --base-url option in docker container #1600

Closed JakeMY-coder closed 3 weeks ago

JakeMY-coder commented 3 weeks ago

Describe the bug

When using the mo.ui.altair_chart for interactive altair charts, the chart cells seem to break completely if you are launching inside of a docker container and using the --base-url option (cells return 404). Confirmed that simply removing the --base-url resolved the issue.

Environment

{
  "marimo": "0.6.17",
  "OS": "Linux",
  "OS Version": "5.15.0-107-generic",
  "Processor": "",
  "Python Version": "3.12.4",
  "Binaries": {
    "Browser": "--",
    "Node": "--"
  },
  "Requirements": {
    "click": "8.1.7",
    "importlib-resources": "missing",
    "jedi": "0.19.1",
    "markdown": "3.6",
    "pymdown-extensions": "10.8.1",
    "pygments": "2.18.0",
    "tomlkit": "0.12.5",
    "uvicorn": "0.30.1",
    "starlette": "0.37.2",
    "websockets": "12.0",
    "typing-extensions": "missing",
    "black": "24.4.2"
  }
}

Code to reproduce

import altair as alt
import marimo as mo
from vega_datasets import data

chart = (
    alt.Chart(data.cars())
    .mark_point()
    .encode(
        x="Horsepower",
        y="Miles_per_Gallon",
        color="Origin",
    )
)

chart = mo.ui.altair_chart(chart)

mo.hstack([chart, chart.value])
mscolnick commented 3 weeks ago

Thanks for the repro - i have a fix in review