JSmol bokeh extension
This extension lets you visualize atomic structures in bokeh using JSmol.
Features
- Works both using bokeh and bokeh server
- See example.html. Structure displays in standalone html, button will start working in bokeh server
Prerequisites
- python 2.7 or later
- NodeJS 6.10 or later (see the bokeh developer documentation for instructions)
Note: As of 2019-06, NodeJS is required to compile the .ts / .coffee files.
Once bokeh provides guidelines on how to bundle compiled javascript, the NodeJS dependency may be dropped.
Installation
Versioning
- jsmol-bokeh-extension 0.1.x works with bokeh < 1.1 (written in CoffeScript)
- jsmol-bokeh-extension 0.2 and above works with bokeh >= 1.1 (written in TypeScript)
pip install jsmol-bokeh-extension
Usage
Below a complete example.py demonstrating how to use the jsmol bokeh extension:
rom bokeh.models import ColumnDataSource
from bokeh.io import show, curdoc
from bokeh.models.widgets import Button, TextInput
from bokeh.layouts import layout, widgetbox
from jsmol_bokeh_extension import JSMol
script_source = ColumnDataSource()
info = dict(
height="100%",
width="100%",
serverURL="https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
use="HTML5",
j2sPath="https://chemapps.stolaf.edu/jmol/jsmol/j2s",
script=
"background black;load https://chemapps.stolaf.edu/jmol/jsmol-2013-09-18/data/caffeine.mol",
)
applet = JSMol(
width=600,
height=600,
script_source=script_source,
info=info,
)
button = Button(label='Execute')
inp_script = TextInput(value='background white;')
def run_script():
script_source.data['script'] = [inp_script.value]
button.on_click(run_script)
ly = layout([applet, widgetbox(button, inp_script)])
show(ly)
curdoc().add_root(ly)
Note: The example can be run both using bokeh and bokeh server:
# run locally (displays structure but button won't work)
python example.py
# run using bokeh server (displays structure and button should work)
bokeh serve example.py --show
Links
- This bokeh extension is based on the surface3d example and extension widget
- See also the JSmol Info dict
Metadata
Release files for jsmol-bokeh-extension 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsmol-bokeh-extension-0.2.2.tar.gz | 5.5 kB | Without provenance | Details for jsmol-bokeh-extension-0.2.2.tar.gz |
Release files / jsmol-bokeh-extension-0.2.2.tar.gz
| Download URL | jsmol-bokeh-extension-0.2.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a08b152284cc689f705961db9c859a65f0197bf039d86b6a41944a015a95038
|
|
BLAKE2b-256 checksum How to use checksums |
ffc2b9df0a9c265ffc9907062c5130c2b5ef6fa2b5efb45de7c9cabfe0bbdbe6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for jsmol-bokeh-extension 0.2.2
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.