stspeck
The Speck molecule viewer for Streamlit, with the
same renderer and settings as the ipyspeck Jupyter widget: ambient occlusion,
cartoons, molecular surfaces (optionally transparent), metallic and glossy
materials, shadows, fog, outlines, highlighting, trajectories and unit cells.
pip install stspeck # Python 3.8+, Streamlit 1.20+
import streamlit as st
import stspeck
# Any structure as PDB or (extended) XYZ text
stspeck.speck(data=open("1ubq.pdb").read(), cartoon=True, surface=True, surfaceOpacity=0.35)
# Loaders return keyword arguments to splat into speck()
stspeck.speck(**stspeck.fetch_alphafold("Q8W3K0"), preset="cover", height=500)
stspeck.speck(**stspeck.fetch_pdb("4HHB"), highlight={"resName": "HEM"}, ghost=0.6)
stspeck.speck(**stspeck.from_ase(atoms), preset="metal") # also from_rdkit, from_pymatgen
- Settings: every ipyspeck setting is a keyword argument; see
stspeck.SETTINGSfor names and defaults, andstspeck.PRESETSfor named looks (preset="cover"). - Toolbar: styles, cartoon / surface / ligand toggles, standard views, color
schemes and a camera button that downloads a high-resolution PNG
(
export_width=3000,export_scale=...). Toolbar choices persist across reruns. - State: with
return_state=Truethe call returns the camera, the current settings andnframes; pass the camera back ascamera=to restore a view. - Trajectories: multi-frame XYZ or multi-model PDB; drive
frame=with a slider (stspeck.count_frames(data)gives the range).
Run the demo with streamlit run example/app.py.
Gallery
For Jupyter, use ipyspeck, which has the same settings.
Development
The frontend (frontend/) bundles the viewer shared with ipyspeck (../core).
Build it with cd frontend && npm install && npm run build, which also compiles
../core. pip install . runs the same build when stspeck/static is missing.
Release files for stspeck 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stspeck-0.8.0.tar.gz | 68.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stspeck-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.1 kB
Release files / stspeck-0.8.0.tar.gz
| Download URL | stspeck-0.8.0.tar.gz |
|---|---|
| Size | 68.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
556c9271bda8f9e4c8fd80b91e76064ab2db887149a1f232070f9bc3ab20de41
|
|
BLAKE2b-256 checksum How to use checksums |
5eff0974030a6b8457c1640f6d7a845247cb22469101170e3c7fde7ae78c20a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / stspeck-0.8.0-py3-none-any.whl
| Download URL | stspeck-0.8.0-py3-none-any.whl |
|---|---|
| Size | 50.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de08ba2d2fc150ca2d0b8741f3172cc144aea8a27bf8c1e207c0776bfed5de4f
|
|
BLAKE2b-256 checksum How to use checksums |
fde5b0dcee8effb39ef7a430ce314a1c70238d20d256494bd3a0ad5955d010d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|