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.
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 opens as a structure showing its first frame only, not as an animated 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). No host-side streaming like the VS Code extension, so very large trajectories can't be paged frame by frame. 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 labextension build . (needs jupyter 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 devDependency is not imported by anything here. @jupyterlab/builder's webpack config carries an unconditional ProvidePlugin({ process: 'process/browser' }), which has to resolve from this package under pnpm's strict layout. Don't delete it as unused.
The build runs in two stages, which is load-bearing:
- Vite compiles
src/index.tsplus the MatterViz Svelte component graph into plain ESM underlib/. 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. jupyter labextension buildwebpackslib/index.jsinto a federated module underdata/share/jupyter/labextensions/matterviz-jupyterlab/, whichuv_buildcopies 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 labextension build emits an asset-size warning for the three-dimensional viewer chunks. That is expected for a bundle carrying three.js.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matterviz_jupyterlab-0.5.0-py3-none-any.whl.
File metadata
- Download URL: matterviz_jupyterlab-0.5.0-py3-none-any.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9550410a93602a340448b7010d4dece7c898ea690edf3b2d5262de9e993d8498
|
|
| MD5 |
bbf0351c26f4dbf8027070fc295ac92f
|
|
| BLAKE2b-256 |
093880533fba604b1eb6a233c5bcebbc63792ab7c3296a11610740152519a223
|