Skip to main content

Platform Support

megane ships in five distributions. They share the same Rust parser core (compiled to WASM and PyO3), but the host UI and the set of registered file types differ. This page is the single reference for what works on which platform, and it is descriptive of the current state — including known gaps.

Platforms

PlatformEntryWhat it is
Standalone web appsrc/index.tsx, served by megane serveFull-featured viewer with pipeline editor, drag-and-drop, file dialogs, and WebSocket trajectory streaming.
Jupyter widget (anywidget)src/widget.ts + python/megane/widget.pyEmbedded viewer in a notebook cell, driven by Python (MolecularViewer).
JupyterLab labextensionjupyterlab-megane/src/index.tsDocument-style viewer launched from the JupyterLab file browser.
VSCode extensionvscode-megane/webview/main.tsxCustom editor activated when a registered file type is opened in VS Code.
Python package (PyO3)python/megane/parsers/Programmatic API for parsing files into Python objects. No viewer.

File-format support

Legend:

  • — openable directly from the platform's native UI (file browser, drag-drop, customEditor, LoadStructure/LoadTrajectory node, etc.)
  • API — parser exists and is reachable programmatically, but the platform does not expose a UI opener for this format
  • — not supported

Structure formats

FormatExtensionsStandaloneJupyter widgetJupyterLabVSCodePython
PDB.pdbAPI
GRO.groAPI
XYZ.xyzAPI
MOL.molAPI
SDF.sdfAPI
MOL2.mol2API
CIF.cifAPI
LAMMPS data.data, .lammpsAPI

Trajectory formats

FormatExtensionsStandaloneJupyter widgetJupyterLabVSCodePython
XTC.xtcAPI✓¹✓¹
ASE trajectory.trajAPI
LAMMPS dump.lammpstrj, .dumpAPI✓¹✓¹

¹ Trajectory-only formats need a topology already loaded. Opening a .xtc / .lammpstrj / .dump directly surfaces an actionable error; recover by opening a structure file (PDB, GRO, …) first or by wiring a Load Structure node in the always-mounted pipeline editor.

Sources of truth: crates/megane-wasm/src/lib.rs (browser parsers), crates/megane-python/src/lib.rs (Python parsers), src/components/nodes/LoadStructureNode.tsx and src/components/nodes/LoadTrajectoryNode.tsx (standalone accept lists), jupyterlab-megane/src/filetypes.ts (JupyterLab IFileType registrations), vscode-megane/package.json (VSCode customEditors).

UI features

FeatureStandaloneJupyter widgetJupyterLabVSCodePython
Drag-and-drop into viewern/a
Built-in file pickerhosthostn/a
Visual pipeline editor✓ (.megane.json)n/a
Trajectory timeline / scrubbingn/a
WebSocket trajectory streamingn/a
Multi-layer rendering✓ (via pipeline)n/a
frame_change callback✓ (React prop)✓ (Python event)n/a
selection_change / measurement eventsn/a
Programmatic frame seek (frame_index = N)n/a

Notes:

  • host means the parent app provides the file picker (the JupyterLab file browser, the VS Code explorer); megane itself does not render one.
  • The Jupyter widget intentionally does not mount the visual pipeline editor — pipelines are built in Python (megane.Pipeline) and pushed via MolecularViewer.set_pipeline(). Use the standalone app, JupyterLab labextension, or VSCode extension to edit pipelines visually.
  • The standalone app is the only platform with megane serve WebSocket streaming; other platforms load full trajectories into memory.
  • The standalone React MeganeViewer exposes an onFrameChange?: (frame: number) => void prop that fires on every trajectory frame transition — useful for keeping a host Plotly figure in sync.

Load methods / APIs

How data gets into the viewer on each platform:

PlatformPrimary load pathAPI surface
StandaloneDrag-and-drop, file dialog, megane serve <file>, WebSocketparseStructureFile(file) (TypeScript), pipeline node LoadStructure / LoadTrajectory
Jupyter widgetPython only — no in-cell file pickerMolecularViewer.load(pdb_path, xtc=, traj=) (deprecated) or MolecularViewer.set_pipeline(Pipeline) (recommended)
JupyterLabClick a registered file type in the file browserInternally reads context.model (jupyterlab-megane/src/MeganeDocWidget.tsx)
VSCodeOpen a registered file from the explorer; extension host posts loadFile / loadPipeline to the webviewpostMessage({ type: "loadFile", … }) (vscode-megane/webview/main.tsx)
Pythonfrom megane.parsers import …load_pdb, load_cif, load_lammps_data, load_traj, load_trajectory (XTC), and the parse_* PyO3 functions

Known gaps

These are formats or features that the parser layer supports but a given platform does not yet wire into its UI. They are documented here so users do not file bugs against expected-but-absent behaviour.

  • Trajectory-only opens require a topology first. On VSCode and JupyterLab, opening a .xtc / .lammpstrj / .dump file before any structure is loaded surfaces a friendly error. The recommended flow is to open the structure first, or to use the pipeline editor (always mounted on these hosts) to wire a Load Structure node.
  • Jupyter widget has no in-cell file picker or drag-and-drop. This is intentional — the widget is Python-driven. Use set_pipeline() with a Pipeline to load any supported format.
  • Jupyter widget has no visual pipeline editor. The editor's React surface relies on host chrome (drag handles, side panel layout) that the anywidget cell cannot reliably render, so it is only shipped on the standalone app, JupyterLab labextension, and VSCode extension. Build pipelines in Python with megane.Pipeline and push them via MolecularViewer.set_pipeline().
  • selection_change / measurement events are widget-only. Other platforms do not emit these to a host. The standalone React component does expose onFrameChange (see UI features table).