Skip to content

Add cometx panel-studio for local Python panel development - #30

Merged
dsblank merged 4 commits into
mainfrom
dsb/panel-studio
Oct 28, 2026
Merged

dsblank merged 4 commits into
mainfrom
dsb/panel-studio

Conversation

@dsblank

@dsblank dsblank commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What

cometx panel-studio [FILE] opens an editor in the browser for writing and testing a Comet Python panel on your own machine, then uploading it.

  • Sidebar: Comet server (/clientlib/ is added for you), API key, workspace, project (sortable by recently updated or name, with an "Open in Comet" link), and the experiments the panel sees (sortable too; the first 25 are selected, like a dashboard's first table page).
  • Editor: a code box starting with Comet's own default Python panel template; type a path or Browse... the file system; Load / Save keep the panel in a file for version control.
  • Run: the panel runs the way it does on comet.com, against your real experiments, shown beside the editor.
  • Upload...: to a project dashboard, new or existing (a same-named panel is replaced, otherwise it goes in a "Panel Studio" section), or to the workspace's Panel library (a same-named panel is replaced).
cometx panel-studio my_panel.py --workspace WS --project PROJECT

How it runs panels "as on comet.com"

Comet's Python panel server turns each panel into a Streamlit page whose preamble puts the panel context into st.session_state["comet_config_override"]. comet_ml reads it from there, keyed by a page file named page_*. The studio does the same: a second Streamlit server serves the panel pages, built with the engine's own code, so the real comet_ml.ui, API().get_panel_*, print, and the %pip install / %include magics all work unchanged. Ports move up automatically if 8501/8502 are taken.

Also in this PR

  • cometx.views synced with comet_ml.views (comet-python-client#2769): option values the UI silently ignores (e.g. transform_y="log", plot_type="BOX", "average", "hide") are mapped to the UI's values or rejected; bar_panel(group_by=...); python_panel(code=...) and javascript_panel store code in the view.
  • API.update_view replaces a project view in place (uses comet_ml's own when present).
  • README sections for panel-studio and the updated views.

For reviewers: vendored code and licensing

cometx/panel_engine.py and cometx/panel_pip_utils.py are vendored from comet-ml/code-panels at b57eab54 (python-panel-engine/compute_engine_server/__main__.py and comet-pip-utils/.../pip_utils.py), with every change marked cometx:. Their headers say "All rights reserved" / "can not be copied and/or distributed without the express permission of Comet ML Inc.", while cometx is MIT on PyPI. This needs a sign-off (or a license change on those files) before release.

Also note: like Comet's panel server, each panel page holds the API key in plain text, here in a private (0700) temp directory that is deleted when the studio stops.

Testing

  • 459 unit tests pass, including new tests/unit/test_panel_studio.py (panel config, page writing, magic commands, dashboard layout edits, uploads, URL handling, file listing, sorting) and tests/unit/test_views.py (ported from comet_ml).
  • Editor and panel pages run headlessly with Streamlit AppTest against comet.com; uploads tested live on staging (new dashboard, replace in place, add to an existing dashboard without disturbing it, Panel library create/update).
  • End to end in headless Chrome against comet.com: Run draws the panel with the selected experiments in their dashboard colors; Browse, Load, Save, sorting, and the logo checked.

🤖 Generated with Claude Code

`cometx panel-studio [FILE]` opens a browser editor for writing and testing
a Comet Python panel locally: pick a workspace, project and experiments in
the sidebar, edit or browse to a panel file, press Run, and the panel runs
the way it does on comet.com, against real experiments. Upload puts it on
a project dashboard (replacing a same-named panel, or adding it to a
"Panel Studio" section) or in the workspace's Panel library.

It runs panels like Comet's Python panel server does: each panel is a
Streamlit page served by a second Streamlit server, built with the
engine's own code, vendored from comet-ml/code-panels at b57eab54 into
cometx/panel_engine.py and cometx/panel_pip_utils.py with each change
marked. The page's preamble gives comet_ml the panel context (workspace,
project, experiment keys, colors), so the real comet_ml.ui and
API().get_panel_* calls work, as do print and the %pip/%include magics.
Like a dashboard, the first 25 experiments are selected to start.

cometx.views is synced with comet_ml.views: panel option values the UI
silently ignored are mapped or rejected, bar_panel gains group_by, and
python_panel(code=...) and javascript_panel store code in the view.
API.update_view replaces a project view in place, using comet_ml's own
where the installed version has one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@baz-reviewer

baz-reviewer Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review this PR on Baz

Baz Summary

Add cometx panel-studio, a local Streamlit-based environment for editing, running, and uploading Comet Python panels with dashboard-compatible context, experiment selection, dependency handling, and file persistence. Extend cometx.views and API view operations to support validated dashboard schemas, inline Python and JavaScript panels, grouped visualizations, and in-place updates, while documenting and testing the new workflows.

graph LR
main_cometx_cli_init_py_("main (cometx/cli/__init__.py)"):::modified
panel_studio_("panel_studio"):::added
start_panel_server_("start_panel_server"):::added
main_cometx_cli_panel_studio_app_py_("main (cometx/cli/panel_studio_app.py)"):::added
sidebar_("sidebar"):::added
upload_dialog_("upload_dialog"):::added
upload_to_dashboard_("upload_to_dashboard"):::added
API_update_view_("API.update_view"):::added
main_cometx_cli_init_py_ -- "Adds panel-studio command dispatch to the CLI." --> panel_studio_
panel_studio_ -- "Creates a local Streamlit server for rendered panel pages." --> start_panel_server_
panel_studio_ -- "Launches the editor with ports, paths, and selection context." --> main_cometx_cli_panel_studio_app_py_
main_cometx_cli_panel_studio_app_py_ -- "Supplies authenticated workspace, project, and experiment context." --> sidebar_
main_cometx_cli_panel_studio_app_py_ -- "Enables publishing edited panel code to dashboards or libraries." --> upload_dialog_
upload_dialog_ -- "Sends workspace, project, dashboard, panel name, and source code." --> upload_to_dashboard_
upload_to_dashboard_ -- "Persists modified dashboard view while retaining its template identity." --> API_update_view_
classDef added stroke:#15AA7A
classDef removed stroke:#CD5270
classDef modified stroke:#EDAC4C
linkStyle default stroke:#CBD5E1,font-size:13px
Loading

Topics

TopicDetails
Views and dashboard API Enhance dashboard view construction and persistence by validating UI option values, adding grouped bar charts and inline Python or JavaScript panels, preserving compatible schemas, and updating existing project views in place.
Modified files (3)
  • cometx/api.py
  • cometx/views.py
  • tests/unit/test_views.py
Latest Contributors(2)
UserCommitDate
doug@comet.comFix panel-studio tests...October 28, 2026
doug.blank@gmail.comfeat: add create_dashb...April 09, 2026
Documentation and release Document the new panel-development workflow, upload behavior, view-builder capabilities, compatibility model, operational options, security considerations, and release licensing implications for vendored panel-server code.
Modified files (3)
  • PANEL-STUDIO.md
  • README-panel-and-dashboard-enhancements.md
  • README.md
Latest Contributors(2)
UserCommitDate
doug@comet.comAddress review: depend...October 28, 2026
doug.blank@gmail.comdocs(admin): document ...October 01, 2026
Panel Studio workflow Deliver a browser-based panel-studio command that starts coordinated Streamlit editor and panel servers, injects Comet-compatible context, supports local file browsing and persistence, runs panel code with %pip and %include handling, and uploads panels to dashboards or the workspace library.
Modified files (9)
  • cometx/cli/__init__.py
  • cometx/cli/assets/comet-logo.png
  • cometx/cli/panel_studio.py
  • cometx/cli/panel_studio_app.py
  • cometx/panel_engine.py
  • cometx/panel_pip_utils.py
  • cometx/panel_studio.py
  • setup.py
  • tests/unit/test_panel_studio.py
Latest Contributors(2)
UserCommitDate
doug@comet.comAddress review: depend...October 28, 2026
chasefortierAdd workspace creation...March 30, 2026


Merger  Activate to get a short verdict whether this PR is good to go or not

Skills  Activate Skill Maintainer to keep your skills up to date

Planner  This PR would have been improved with Baz Planner - Try it now

Douglas Blank and others added 2 commits October 28, 2026 09:28
Covers starting the studio, the sidebar and what the panel sees, editing
and files, running and uploading panels, writing panels, how it matches
comet.com, command-line options, troubleshooting and security notes. The
README's panel-studio section links to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two ported view tests called View.layout_scope(), which released comet_ml
doesn't have yet; the tests' own assertions already check where the
sections are stored, so those calls are dropped.

Released comet_ml caches views/get-all and code-panel/get-all, so the
upload dialog could read a dashboard or the Panel library as it was before
the last upload, then create a duplicate or drop a panel just added.
Uploads now use an API with caching off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread cometx/cli/panel_studio_app.py Resolved
Comment thread cometx/cli/panel_studio_app.py Resolved
Comment thread cometx/cli/panel_studio_app.py Resolved
Comment thread cometx/panel_pip_utils.py Resolved
Comment thread cometx/cli/panel_studio.py Resolved
…leanup

- Require plotly, which Comet's default panel template imports, and
  streamlit>=1.41.0, the first release with every Streamlit feature the
  studio uses (st.dialog, st.context, tertiary buttons).
- Upload is disabled while the new-dashboard name is blank.
- The vendored pip argument parser listed --trusted-host as a flag without
  a value, so its host was taken for a package name; it now keeps the
  value (change marked in the vendored file).
- The studio's temp folder, whose pages hold the API key, is deleted when
  the studio stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dsblank
dsblank merged commit 9ba5e6e into main Oct 28, 2026
2 checks passed
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.

1 participant