marimo icon indicating copy to clipboard operation
marimo copied to clipboard

OUTPUT_MAX_BYTES should be a setting

Open liquidcarbon opened this issue 11 months ago • 1 comments

HNY!

Just ran into the OUTPUT_MAX_BYTES warning, and it's quite a nuisance IMO.

  1. there's no recovering from this helpful message - not great, especially in App mode because it effectively breaks the page till the app is restarted
  2. why does it MARIMO_OUTPUT_MAX_BYTES need to be an env var? it's not possible to change it without restarting everything - couldn't it be a setting? what's the idea of separating these rather random settings out into env vars?
marimo supports the following environment variables for advanced configuration:

| Environment Variable          | Description                                                                                                                  | Default Value   |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------- |
| `MARIMO_OUTPUT_MAX_BYTES`     | Maximum size of output that marimo will display. Outputs larger than this will be truncated.                                 | 5,000,000 (5MB) |
| `MARIMO_STD_STREAM_MAX_BYTES` | Maximum size of standard stream (stdout/stderr) output that marimo will display. Outputs larger than this will be truncated. | 1,000,000 (1MB) |
| `MARIMO_SKIP_UPDATE_CHECK`    | If set to "1", marimo will skip checking for updates when starting.                                                          | Not set         |

  1. OR could mo._messaging.streams.OUTPUT_MAX_BYTES = 10_000_000 work similarly to pd.options.display (which can be changed upfront in the notebook)?
  2. I have indeed produced large output, but it might not have been considered that it is spread across many lazy tabs (altair charts)

liquidcarbon avatar Jan 08 '25 21:01 liquidcarbon

I am fine with all three of these being TOML-driven configuration, in addition to ENV vars, with environment variables taking precedence over TOML config.

akshayka avatar Jan 13 '25 17:01 akshayka

@mscolnick This would really help me for Buckaroo. I was playing in the live WASM playground and I ran up against the limit. Interestingly when I run locally, marimo doesn't complain. Setting the environment variable via os.environ doesn't fix it, because that setting is read at package import time.

My widget has a large JS artifact that is 3 or 3.8MB depending on minimization.

paddymul avatar Jan 29 '25 03:01 paddymul

first improvement is that we can read this at runtime. there doesn't seem to be a good reason not to

mscolnick avatar Jan 29 '25 16:01 mscolnick

I'll try to take a swing at a PR on Friday/over the weekend.

Correct me if I'm wrong, but does your PR process create a testing WASM instance to play with?

paddymul avatar Jan 29 '25 19:01 paddymul

@paddymul, yes it does but i might have to kick it off, which i can

mscolnick avatar Jan 29 '25 21:01 mscolnick

Sorry for letting this fall out of my attention. Thanks for fixing it. This does fix the bug I was running into when running against the version from the PR https://marimo.app?v=0.11.8-dev2

I still need to do a couple of CSS fixes. When will this be released to your public site?

Image

paddymul avatar Feb 20 '25 14:02 paddymul

@paddymul, i can do a release today

mscolnick avatar Feb 20 '25 15:02 mscolnick

Thank you again.

paddymul avatar Feb 20 '25 15:02 paddymul

for anyone looking to workaround the limit as quickly as possible, you do so per script with this line

import marimo as mo
mo._runtime.context.get_context().marimo_config["runtime"]["output_max_bytes"] = 10000000000

qgerman2 avatar Jul 25 '25 00:07 qgerman2