Skip to main content

MatterViz for JupyterLab

Open crystal structures, MD trajectories, band structures and volumetric data directly from the JupyterLab file browser — double-click a .cif, or right-click → Open With → MatterViz. The counterpart to the MatterViz VS Code extension, for people whose file browser lives inside JupyterHub.

Li10GeP2S12.cif opened from the JupyterLab file browser

Install

pip install matterviz-jupyterlab

That's it — the wheel ships prebuilt assets, so there is no jupyter labextension install step and no Node.js on the user's machine. Restart JupyterLab and verify with:

jupyter labextension list

Requires JupyterLab 4.

Supported formats

Kind Extensions
Structures cif, mcif, mmcif, xyz, extxyz, poscar, vasp, pdb, mol, mol2, sdf, lmp
Trajectories traj (ASE), h5/hdf5 (vaspout, torch-sim), lammpstrj, multi-frame xyz
Volumetric cube, CHGCAR, LOCPOT, ELFCAR, PARCHG, AECCAR*, vaspwave.h5
Fermi surfaces bxsf, frmsf

Extensionless VASP names (POSCAR, CONTCAR, XDATCAR and the volumetric ones above) are matched by filename. Every format is also recognized with a .gz suffix. Structure JSON (pymatgen/ASE as_dict() output) is available under Open With without displacing Lab's built-in JSON viewer.

A .dump file with several ITEM: TIMESTEP frames opens as a trajectory. .xtc, .trr and .dcd are deliberately not registered — MatterViz has no decoder for them, so claiming them would replace another application's handler with an error message.

Limits

Files above 100 MB refuse to parse (transfer already happened; parse in the kernel instead, e.g. with pymatviz's TrajectoryWidget). Below that, parsing runs in a Web Worker so the Lab UI stays responsive; XYZ/EXTXYZ, XDATCAR and LAMMPS dump trajectories above DEFAULTS.trajectory.index_above_bytes (25 MB) are indexed there and decoded frame by frame on demand (ASE .traj always is), and the worker is terminated when the viewer closes. If the worker fails to start, or hasn't started within 10 s, the file parses on the main thread instead, which can freeze the Lab UI while it runs; a worker that crashes after starting shows an error. No host-side streaming like the VS Code extension, so the 100 MB ceiling is hard. Open viewers also don't auto-refresh on external writes — JupyterLab has no filesystem watcher; use File → Reload from Disk.

Development

pnpm install --ignore-workspace --config.strict-dep-builds=false
pnpm build   # vite build && jupyter-builder build . (needs jupyterlab on PATH)
uv build --wheel

uv_build packages whatever is already on disk — run pnpm build first or you will ship an empty extension. The install flags are needed because this package is outside the monorepo workspace and @jupyterlab/application depends on fontawesome, whose install script pnpm declines to run unattended and then exits non-zero over.

The process, style-loader and css-loader devDependencies are not imported by anything here. @jupyter/builder's rspack config names them by bare specifier (ProvidePlugin({ process: 'process/browser' }) and its CSS rule), so under pnpm's strict layout they have to resolve from this package. Don't delete them as unused. @jupyter/builder (not the legacy @jupyterlab/builder) also ships @jupyterlab/core-meta, so the build never fetches it from npm or GitHub.

The build runs in two stages, which is load-bearing:

  1. Vite compiles src/index.ts plus the MatterViz Svelte component graph into plain ESM under lib/. All @jupyterlab/* and @lumino/* imports stay external so JupyterLab supplies the shared singleton instances — bundling a private copy would produce plugin tokens that never match the ones in the application registry.
  2. jupyter-builder build bundles lib/index.js into a federated module under data/share/jupyter/labextensions/matterviz-jupyterlab/, which uv_build copies into the wheel's data directory so pip unpacks it over {sys.prefix}/share.

Webpack cannot build MatterViz directly: the source relies on Vite-only features (import.meta.glob, .json.gz imports) and Svelte compilation. Feeding it already-compiled ESM sidesteps both. Vite's dynamic-import chunks survive the second pass, so HDF5 support stays a ~4.6 MB chunk fetched only when someone actually opens an .h5 file.

jupyter-builder build emits an asset-size warning for the three-dimensional viewer chunks. That is expected for a bundle carrying three.js.

Metadata

Release files for matterviz-jupyterlab 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for matterviz-jupyterlab 0.10.0
File Interpreter ABI Platform Actions
matterviz_jupyterlab-0.10.0-py3-none-any.whl Python 3 none any Details for matterviz_jupyterlab-0.10.0-py3-none-any.whl

Release files / matterviz_jupyterlab-0.10.0-py3-none-any.whl

Download URL matterviz_jupyterlab-0.10.0-py3-none-any.whl
Size 4.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d36b3c5c8353fb49360089f359fe66f50860ffafdcb0a768d85c6885a589ab00
BLAKE2b-256 checksum
How to use checksums
aa40a1024f76ce7717cdd2b0d86960e9141ff3be0094d66c602a9b84bdd5e796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for matterviz-jupyterlab 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page