Skip to content

Commit da98666

Browse files
committed
Initial Commit. v0.1
0 parents  commit da98666

File tree

13 files changed

+254
-0
lines changed

13 files changed

+254
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**.ipynb_checkpoints/
2+
**__pycache__

CHANGELOG.md

Whitespace-only changes.

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2020, Forschungszentrum Juelich GmbH, Juelich Supercomputing Centre
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
graft jupyter_trame_proxy/share
2+
graft jupyter_trame_proxy/icons
3+
graft jupyter_trame_proxy/bin

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# jupyter-trame-proxy
2+
Integrates [trame](https://github.com/Kitware/trame) in your Jupyter environment using [ParaView Visualizer](https://github.com/Kitware/paraview-visualizer).
3+
4+
## Requirements
5+
- Python **3.9+**
6+
- ParaView **5.10+**
7+
- Jupyter Notebook 6.0+
8+
- JupyterLab 2.1+
9+
10+
This extension will start the `pv_visualizer` package. You must make sure it is on the PYTHONPATH! Adjust [launch_trame.sh](jupyter_trame_proxy/share/launch_trame.sh) to ensure this.
11+
12+
## Install
13+
14+
#### Create and Activate Environment
15+
```
16+
virtualenv -p python3 venv
17+
source venv/bin/activate
18+
```
19+
20+
#### Install jupyter-trame-proxy
21+
```
22+
pip install git+https://github.com/jwindgassen/jupyter-trame-proxy.git
23+
```
24+
25+
#### Enable jupyter-trame-proxy Extensions
26+
For Jupyter Classic, activate the jupyter-server-proxy extension:
27+
```
28+
jupyter serverextension enable --sys-prefix jupyter_server_proxy
29+
```
30+
31+
For Jupyter Lab, install the @jupyterlab/server-proxy extension:
32+
```
33+
jupyter labextension install @jupyterlab/server-proxy
34+
jupyter lab build
35+
```
36+
37+
## Starting
38+
Click on the *ParaView trame* icon from the Jupyter Lab Launcher or the *ParaView trame* item from the new dropdown in Jupyter Classic.
39+
40+
### Security
41+
In the current state, trame will launch an **unprotected, open website** on a local port. On multi-user machines, your data will be visible to anyone!!
42+
43+
### Jupyter-Server-Proxy
44+
[Jupyter-Server-Proxy](https://jupyter-server-proxy.readthedocs.io) lets you run arbitrary external processes alongside your notebook and provide web access to them. After installing this proxy, you can start trame using the *ParaView trame* entry in the launcher. It will start the server (which might take a few seconds) and open the website in a new tab.
45+
46+
## License
47+
This software is provided under the BSD 3-Clause

conftest.py

Whitespace-only changes.

environment.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# run: conda env create --file environment.yml
2+
name: jupyter-trame
3+
channels:
4+
- conda-forge
5+
dependencies:
6+
- jupyterlab>=2
7+
- jupyterlab_server
8+
- jupyter-server-proxy>=3.1.0
9+
- jupyter_conda
10+
- pip
11+
- pip:
12+
- -r file:requirements.txt

jupyter_trame_proxy/__init__.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
import logging
3+
4+
logger = logging.getLogger(__name__)
5+
logger.setLevel('INFO')
6+
7+
HERE = os.path.dirname(os.path.abspath(__file__))
8+
9+
10+
def _trame_mappath(path):
11+
return path
12+
13+
14+
def setup_trame():
15+
""" Setup commands and and return a dictionary compatible
16+
with jupyter-server-proxy.
17+
"""
18+
19+
# create command
20+
cmd = [
21+
os.path.join(HERE, 'share/launch_trame.sh'), "{port}"
22+
]
23+
24+
logger.info('Command: ' + ' '.join(cmd))
25+
26+
return {
27+
'command': cmd,
28+
'mappath': _trame_mappath,
29+
'absolute_url': False,
30+
'timeout': 90,
31+
'new_browser_tab': True,
32+
'launcher_entry': {
33+
'enabled': True,
34+
'icon_path': os.path.join(HERE, 'icons/logo.svg'),
35+
'title': 'ParaView trame',
36+
},
37+
}

jupyter_trame_proxy/icons/logo.svg

Lines changed: 65 additions & 0 deletions
Loading
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# If you need to modify the envoronment before you launch pv_visualizer, do it here!
4+
5+
# Example:
6+
# module purge
7+
# module load Stages/2022
8+
# module load GCC
9+
# module load ParaStationMPI
10+
# module load trame
11+
# module load ParaView/5.10.1-EGL
12+
13+
python -c "from pv_visualizer.app.main import main; main(port=$1, no_http=True)"

0 commit comments

Comments
 (0)