Skip to content

feat: add negotiated notebook media exports - #79

Merged
peter-gy merged 4 commits into
mainfrom
pgy/output-representations
Oct 6, 2026
Merged

peter-gy merged 4 commits into
mainfrom
pgy/output-representations

Conversation

@peter-gy

@peter-gy peter-gy commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Notebook exports can now select nested values through one shared selector grammar and render figures, charts, and displayable values in the media format a consumer requests.

The new media exporter negotiates PDF, SVG, PNG, and other display methods while preserving deterministic rendering metadata such as image display dimensions. Browser image mounts use those dimensions to keep high-density images at their intended figure size. The selector and representation rules are shared by live resolution and prepared exports, with updated examples and reference documentation.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 05:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 46 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/reference/representations.md">

<violation number="1" location="docs/reference/representations.md:26">
P3: This row limits `media` to figures and charts, but `represent()` also exports values implementing IPython MIME methods or marimo’s `_mime_()`. Include displayable values so users can discover this supported input class.</violation>
</file>

<file name="packages/python/src/marimo_export/_execution/plan.py">

<violation number="1" location="packages/python/src/marimo_export/_execution/plan.py:739">
P2: This import shadows a notebook definition named `_marimo_export_select`, so selecting that value passes the helper function to `select_value` instead. Use an alias that cannot match `selector.root` and update the generated call accordingly.</violation>
</file>

<file name="docs/reference/python-api.md">

<violation number="1" location="docs/reference/python-api.md:27">
P2: This row tells users that the `[charts]` extra covers "chart media", but the new `media` exporter distributes over `("altair", "matplotlib", "vl-convert-python")` (see `exporters/_definitions.py`) while the `charts` extra only installs `altair` and `vl-convert-python` (and `[all]` also omits `matplotlib`). A user whose `ExportSpec` uses the `media` exporter on a matplotlib figure will follow this doc to install `[charts]`, then hit the ImportError from `_optional.py` because matplotlib is never installed by any extra. Either add `matplotlib` to the `charts`/`all` extras in `packages/python/pyproject.toml`, or narrow the wording on this row.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/python/src/marimo_export/values.py
Comment thread packages/python/src/marimo_export/values.py Outdated
Comment thread packages/python/src/marimo_export/exporters/__init__.py Outdated
Comment thread packages/browser/src/loader.ts
Comment thread packages/python/src/marimo_export/_execution/plan.py
Comment thread packages/python/src/marimo_export/exporters/altair.py Outdated
Comment thread docs/reference/python-api.md Outdated
Comment thread packages/python/src/marimo_export/values.py Outdated
Comment thread docs/reference/representations.md Outdated
Bound accept lists while reading them, export JSON scalars from display
methods, and call _repr_mimebundle_() without include and exclude when its
signature does not take them. media() reports invalid accept values as
SpecError, mounted images shrink to narrower containers, and altair.png
stays available as the chart PNG shorthand over represent().
@peter-gy
peter-gy merged commit 6fe7c3b into main Oct 6, 2026
20 checks passed
@peter-gy
peter-gy deleted the pgy/output-representations branch October 6, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants