cosmol-viewer 0.2.0.dev3__cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ from .cosmol_viewer import *
2
+
3
+ __doc__ = cosmol_viewer.__doc__
4
+ if hasattr(cosmol_viewer, "__all__"):
5
+ __all__ = cosmol_viewer.__all__
Binary file
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosmol-viewer
3
+ Version: 0.2.0.dev3
4
+ Summary: Molecular visualization tools
5
+ Author-email: 95028 <wjt@cosmol.org>
6
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
7
+ Project-URL: Repository, https://github.com/COSMol-repl/COSMol-viewer
8
+
9
+ # COSMol-viewer
10
+ A high-performance molecular viewer for Python and Rust, powered by a unified Rust core.
11
+ It supports both in-notebook visualization and native desktop rendering, with smooth playback for scientific animations.
12
+
13
+ <div align="center">
14
+ <a href="https://crates.io/crates/cosmol_viewer">
15
+ <img src="https://img.shields.io/crates/v/cosmol_viewer.svg" alt="crates.io Latest Release" />
16
+ </a>
17
+ <a href="https://pypi.org/project/cosmol_viewer/">
18
+ <img src="https://img.shields.io/pypi/v/cosmol_viewer.svg" alt="PyPi Latest Release" />
19
+ </a>
20
+ <a href="https://cosmol-repl.github.io/COSMol-viewer">
21
+ <img src="https://img.shields.io/badge/docs-latest-blue.svg" alt="Documentation Status" />
22
+ </a>
23
+ </div>
24
+
25
+ COSMol-viewer is a compact, cross-platform renderer for molecular and geometric scenes.
26
+ Unlike purely notebook-bound solutions such as py3Dmol, COSMol-viewer runs everywhere:
27
+
28
+ - Native desktop window (Python or Rust) via `egui`
29
+ - Jupyter / IPython notebook via WASM backend
30
+ - Rust applications
31
+
32
+ All implementations share the same Rust rendering engine, ensuring consistent performance and visual output.
33
+
34
+ ---
35
+
36
+ ## Quick concepts
37
+
38
+ - **Scene**: container for shapes (molecules, proteins, spheres, etc.).
39
+ - **Viewer.render(scene, ...)**: create a static viewer bound to a canvas (native or notebook). Good for static visualization.
40
+ - **viewer.update(scene)**: push incremental changes after `Viewer.render()` (real-time / streaming use-cases).
41
+ - **Animation**: An Animation object containing frames and settings.
42
+ - **Viewer.play(animation, interval, loops, width, height, smooth)**: *recommended* for precomputed animations and demonstrations. The viewer takes care of playback timing and looping.
43
+
44
+ **Why prefer `play` for demos?**
45
+ - Single call API (hand off responsibility to the viewer).
46
+ - Built-in timing & loop control.
47
+ - Optional `smooth` interpolation between frames for visually pleasing playback even when input frame rate is low.
48
+
49
+ **Why keep `update`?**
50
+ - `update` is ideal for real-time simulations, MD runs, or streaming data where frames are not precomputed. It provides strict fidelity (no interpolation) and minimal latency.
51
+
52
+ ---
53
+
54
+ # Usage
55
+
56
+ ## python
57
+ See examples in [Google Colab](https://colab.research.google.com/drive/1Sw72QWjQh_sbbY43jGyBOfF1AQCycmIx?usp=sharing).
58
+
59
+ Install with `pip install cosmol-viewer`
60
+
61
+ ### 1. Static molecular rendering
62
+
63
+ ```python
64
+ from cosmol_viewer import Molecule, Scene, Viewer
65
+
66
+ mol_data = open("molecule.sdf", "r", encoding="utf-8").read()
67
+
68
+ mol = Molecule.from_sdf(mol_data).centered()
69
+
70
+ scene = Scene()
71
+
72
+ scene.set_scale(1.0)
73
+
74
+ scene.add_shape_with_id("molecule", mol)
75
+
76
+ viewer = Viewer.render(scene, width=800, height=500)
77
+
78
+ viewer.save_image("screenshot.png")
79
+
80
+ print("Press Any Key to exit...", end='', flush=True)
81
+ _ = input() # Keep the viewer open until you decide to close
82
+ ```
83
+
84
+ ### 2. Animation playback with `Viewer.play`
85
+
86
+ ```python
87
+ from cosmol_viewer import Scene, Viewer, Molecule, Animation
88
+
89
+ anim = Animation(interval=0.05, loops=-1, smooth=False)
90
+ for i in range(1, 10):
91
+ with open(f"frames/frame_{i}.sdf", "r") as f:
92
+ mol = Molecule.from_sdf(sdf.read())
93
+
94
+ scene = Scene()
95
+ scene.add_shape(mol)
96
+ anim.add_frame(scene)
97
+
98
+ Viewer.play(anim, width=800, height=500) # loops=-1 for infinite repeat
99
+ ```
100
+
101
+ more examples can be found in the [examples](https://github.com/COSMol-repl/COSMol-viewer/tree/main/cosmol_viewer/examples) folder:
102
+ ```bash
103
+ cd cosmol_viewer
104
+ python .\examples\render_protein.py
105
+ ```
106
+
107
+ # Documentation
108
+
109
+ Please check out our documentation at [here](https://cosmol-repl.github.io/COSMol-viewer/).
110
+
111
+ ---
112
+
113
+ # Contact
114
+
115
+ For any questions, issues, or suggestions, please contact [wjt@cosmol.org](mailto:wjt@cosmol.org) or open an issue in the repository. We will review and address them as promptly as possible.
116
+
@@ -0,0 +1,5 @@
1
+ cosmol_viewer/__init__.py,sha256=K33zoYpHqUVvpFdMVxmCtw4uKj9ZXrGuQD4D4DuUmjk,135
2
+ cosmol_viewer/cosmol_viewer.abi3.so,sha256=Mto0cCz7_P8-fQR2LkENjTzA8OMKN2AejyRt6799CzU,9545432
3
+ cosmol_viewer-0.2.0.dev3.dist-info/METADATA,sha256=wxaOeQgTjvqXsprquYyzy-Pq3cKsSyKsq_sed1wO_q8,4080
4
+ cosmol_viewer-0.2.0.dev3.dist-info/WHEEL,sha256=gFdlNb0j0ckkRGyO5Pdd9EAOFXlM_OTP3SIGlUPQE20,141
5
+ cosmol_viewer-0.2.0.dev3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.11.5)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-abi3-manylinux_2_17_i686
5
+ Tag: cp310-abi3-manylinux2014_i686