Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Extension #2

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ author_name: Jonathan Windgassen
has_binder: false
has_settings: true
kind: server
labextension_name: jupyter-viz-extension
labextension_name: jupyterlab-trame-manager
project_short_description: A JupyterLab extension.
python_name: jupyter_viz_extension
repository: https://github.com/github_username/jupyter-viz-extension.git
python_name: jupyterlab_trame_manager
repository: https://github.com/jwindgassen/jupyterlab-trame-manager.git
test: false

16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ jobs:

- name: Build the extension
env:
JUVIZ_CONFIGURATION: desktop
TRAME_MANAGER_CONFIGURATION: desktop
run: |
set -eux
python -m pip install .

jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_viz_extension.*OK"
jupyter server extension list 2>&1 | grep -ie "jupyterlab_trame_manager.*OK"

jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter-viz-extension.*OK"
jupyter labextension list 2>&1 | grep -ie "jupyterlab-trame-manager.*OK"
python -m jupyterlab.browser_check

- name: Package the extension
Expand All @@ -50,13 +50,13 @@ jobs:

pip install build
python -m build
pip uninstall -y "jupyter_viz_extension" jupyterlab
pip uninstall -y "jupyterlab_trame_manager" jupyterlab

- name: Upload extension packages
uses: actions/upload-artifact@v4
with:
name: extension-artifacts
path: dist/jupyter_viz_extension*
path: dist/jupyterlab_trame_manager*
if-no-files-found: error

test_isolated:
Expand All @@ -79,13 +79,13 @@ jobs:
sudo rm -rf $(which node)
sudo rm -rf $(which node)

pip install "jupyterlab>=4.0.0,<5" jupyter_viz_extension*.whl
pip install "jupyterlab>=4.0.0,<5" jupyterlab_trame_manager*.whl

jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_viz_extension.*OK"
jupyter server extension list 2>&1 | grep -ie "jupyterlab_trame_manager.*OK"

jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter-viz-extension.*OK"
jupyter labextension list 2>&1 | grep -ie "jupyterlab-trame-manager.*OK"
python -m jupyterlab.browser_check --no-browser-test


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
- name: Upload Distributions
uses: actions/upload-artifact@v4
with:
name: jupyter_viz_extension-releaser-dist-${{ github.run_number }}
name: jupyterlab_trame_manager-releaser-dist-${{ github.run_number }}
path: .jupyter_releaser_checkout/dist
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyter_viz_extension/labextension
jupyterlab_trame_manager/labextension
# Version file is handled by hatchling
jupyter_viz_extension/_version.py
jupyterlab_trame_manager/_version.py

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ node_modules
**/lib
**/package.json
!/package.json
jupyter_viz_extension
jupyterlab_trame_manager
venv
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ No merged PRs

## 0.5.0

([Full Changelog](https://github.com/jwindgassen/jupyter_viz_extension/compare/v0.4.0...3b864edc335ca3ac188fe5bca96287a172e8e8f7))
([Full Changelog](https://github.com/jwindgassen/jupyterlab-trame-manager/compare/v0.4.0...3b864edc335ca3ac188fe5bca96287a172e8e8f7))

### Enhancements made

- Upgrade to Jupyterlab 4.x [#1](https://github.com/jwindgassen/jupyter_viz_extension/pull/1) ([@jwindgassen](https://github.com/jwindgassen))
- Upgrade to Jupyterlab 4.x [#1](https://github.com/jwindgassen/jupyterlab-trame-manager/pull/1) ([@jwindgassen](https://github.com/jwindgassen))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jwindgassen/jupyter_viz_extension/graphs/contributors?from=2023-08-29&to=2024-06-17&type=c))
([GitHub contributors page for this release](https://github.com/jwindgassen/jupyterlab-trame-manager/graphs/contributors?from=2023-08-29&to=2024-06-17&type=c))

[@jwindgassen](https://github.com/search?q=repo%3Ajwindgassen%2Fjupyter_viz_extension+involves%3Ajwindgassen+updated%3A2023-08-29..2024-06-17&type=Issues)
[@jwindgassen](https://github.com/search?q=repo%3Ajwindgassen%2Fjupyterlab-trame-manager+involves%3Ajwindgassen+updated%3A2023-08-29..2024-06-17&type=Issues)

## 0.4.0

- [JSC Configuration: stdout and stderr for ParaView](https://github.com/jwindgassen/jupyter_viz_extension/commit/ac217560cb3492e574b098507ed01b4131cce077)
- [Function Components](https://github.com/jwindgassen/jupyter_viz_extension/commit/f2796a4cf1e45005e3a4527bb6157a2aa0c8f206)
- [Fix JSC Configuration](https://github.com/jwindgassen/jupyter_viz_extension/commit/c44708a653e0101318351846fdb69f439714089a)
- [Add authKeyFile, refactor Configuration](https://github.com/jwindgassen/jupyter_viz_extension/commit/5fd1e8173b01ba72decd2fd05dd9a779d5267ab7)
- [JSC Configuration: stdout and stderr for ParaView](https://github.com/jwindgassen/jupyterlab-trame-manager/commit/ac217560cb3492e574b098507ed01b4131cce077)
- [Function Components](https://github.com/jwindgassen/jupyterlab-trame-manager/commit/f2796a4cf1e45005e3a4527bb6157a2aa0c8f206)
- [Fix JSC Configuration](https://github.com/jwindgassen/jupyterlab-trame-manager/commit/c44708a653e0101318351846fdb69f439714089a)
- [Add authKeyFile, refactor Configuration](https://github.com/jwindgassen/jupyterlab-trame-manager/commit/5fd1e8173b01ba72decd2fd05dd9a779d5267ab7)

## 0.3.1

Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# jupyter_viz_extension
# jupyterlab-trame-manager

[![Github Actions Status](https://github.com/jwindgassen/jupyter_viz_extension/workflows/Build/badge.svg)](https://github.com/jwindgassen/jupyter_viz_extension/actions/workflows/build.yml)
[![Github Actions Status](https://github.com/jwindgassen/jupyterlab-trame-manager/workflows/Build/badge.svg)](https://github.com/jwindgassen/jupyterlab-trame-manager/actions/workflows/build.yml)

**jupyter_viz_extension** or short **JuViz** is an extension for JupyterLab that enables the usage of [ParaView trame](https://kitware.github.io/trame/)
**jupyterlab-trame-manager** (previously known as **jupyter-viz-extension** or **JuViz**) is an extension for JupyterLab that enables the usage of [ParaView trame](https://kitware.github.io/trame/)
within JupyterLab. It bridges Cloud and interactive Visualization, allowing users to run and control their customized
visualization and analysis apps, written in trame, from inside the JupyterLab.
It was written with Cloud-Computing and HPC in mind and is designed to be platform-independant.
Expand All @@ -23,40 +23,40 @@ The extension itself is not linked to any trame dependencies, as these are loade
To install the extension, execute:

```bash
pip install jupyter_viz_extension
pip install jupyterlab_trame_manager
```

#### Configuration

JuViz can be configured with different `Configuration` classes. These contain the platform/architecture specific code
The extension can be configured with different `Configuration` classes. These contain the platform/architecture specific code
and can be used to configure how ParaView and trame Instances are launched, where trame app configs are stored, etc.
The `Configuration` class is selected at runtime via the `JUVIZ_CONFIGURATION` environment variable.
The `Configuration` class is selected at runtime via the `TRAME_MANAGER_CONFIGURATION` environment variable.

Existing `Configuration`s can be found in [the configurations sub-package](./jupyter_viz_extension/configurations)
Existing `Configuration`s can be found in [the configurations sub-package](./jupyterlab_trame_manager/configurations)

To start correctly, set the `JUVIZ_CONFIGURATION` environment variable before starting JupyterLab:
To start correctly, set the `TRAME_MANAGER_CONFIGURATION` environment variable before starting JupyterLab:

```bash
export JUVIZ_CONFIGURATION=desktop
export TRAME_MANAGER_CONFIGURATION=desktop
```

## Adding a trame app to JuViz
## Adding a trame app to the extension

To add a trame app to JuViz that can be configured and executed in JupyterLab, you need to:
To add a trame app to the Extension that can be configured and executed in JupyterLab, you need to:

1. Copy the App and all its Assets and required Files, to the Cluster.
- By default, JuViz will look at all locations in the `JUPYTER_PATH` environment variable and try to detect apps that are in the `trame` subdirectory.
- By default, it will look at all locations in the `JUPYTER_PATH` environment variable and try to detect apps that are in the `trame` subdirectory.
- In most cases, `~/.local/share/jupyter/trame` is a valid location for alls
- Put your trame app in a new subdirectory in the `trame` forder. For example: `~/.local/share/jupyter/trame/my-app`
2. You now need to tell JuViz some details about your app and how it should be launched:
2. You now need to tell the Extension some details about your app and how it should be launched:
- Create a file called `app.yml` with the following values:
- _name_: Display name of the App that is used in the UI
- _working_directory_: The working directory of a launched instance, i.e., from where the launch command should be executed
- _command_: The launch command to execute. This should: load all dependencies, prepare the environment and launch the app.
- The launch command will be passed some arguments for trame, which are generated by JuViz before the launch (authentication key, etc.)
in the `JUVIZ_ARGS` variable. These must be forwarded to trame when the app is started: `python my-app/__init__.py $JUVIZ_ARGS`
- The launch command will be passed some arguments for trame, which are generated by the extension before the launch (authentication key, etc.)
in the `TRAME_INSTANCE_ARGS` variable. These must be forwarded to trame when the app is started: `python my-app/__init__.py $TRAME_INSTANCE_ARGS`

Thats it! Now your app should be available and launchable in the JuViz UI.
Thats it! Now your app should be available and launchable in the UI.

## Connect a trame app to a ParaView Server

Expand All @@ -65,7 +65,7 @@ ToDo
## Creating a custom Configuration

To create a new `Configuration` for a new system, create a new Python file in the _configurations_ sub-package and
create a new class that inherits from `jupyter_viz_extension.configurations.Configuration` (or any other `Configuration` if desired).
create a new class that inherits from `jupyterlab_trame_manager.configurations.Configuration` (or any other `Configuration` if desired).
Here you can override exiting methods of the class and customize, how things are executed. Take a look at the doc-strings
of the base `Configuration` class for a more detailed explanation.

Expand All @@ -80,7 +80,7 @@ The `jlpm` command is JupyterLab's pinned version of [yarn](https://yarnpkg.com/
```bash
pip install -e "."
jupyter labextension develop . --overwrite
jupyter server extension enable jupyter_viz_extension
jupyter server extension enable jupyterlab_trame_manager
jlpm build
```

Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Making a new release of jupyter_viz_extension
# Making a new release of jupyterlab_trame_manager

The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).

Expand Down
4 changes: 2 additions & 2 deletions install.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packageManager": "python",
"packageName": "jupyter_viz_extension",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyter_viz_extension"
"packageName": "jupyterlab_trame_manager",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_trame_manager"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"jupyter_viz_extension": true
"jupyterlab_trame_manager": true
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ServerApp": {
"jpserver_extensions": {
"jupyter_viz_extension": true
"jupyterlab_trame_manager": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# in editable mode with pip. It is highly recommended to install
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
import warnings
warnings.warn("Importing 'jupyter_viz_extension' outside a proper installation.")
warnings.warn("Importing 'jupyterlab_trame_manager' outside a proper installation.")
__version__ = "dev"
from .handlers import setup_handlers
from .model import Model
Expand All @@ -15,19 +15,19 @@
def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": "jupyter-viz-extension"
"dest": "jupyterlab-trame-manager"
}]


def _jupyter_server_extension_points():
return [{
"module": "jupyter_viz_extension"
"module": "jupyterlab_trame_manager"
}]


def _load_jupyter_server_extension(server_app: ServerApp):
model = Model(server_app)
setup_handlers(server_app.web_app, model)

name = "jupyter_viz_extension"
name = "jupyterlab_trame_manager"
server_app.log.info(f"Registered {name} server extension")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

class Configuration(ABC):
"""
The Configuration class allows users to customize the behaviour of the JuViz Backend. By creating a custom
The Configuration class allows users to customize the behaviour of the Backend. By creating a custom
Configuration class, you can change how ParaView is launched, how trame instances are launched and how to load the
config file for a JuViz app. See the methods here or the predefined configuration for reference.
The Configuration is determined at runtime using the "JUVIZ_CONFIGURATION" environment variable.
config file for a trame app. See the methods here or the predefined configuration for reference.
The Configuration is determined at runtime using the "TRAME_MANAGER_CONFIGURATION" environment variable.
"""

def __init__(self, logger):
self._logger = logger

Expand All @@ -39,7 +40,7 @@ def get_open_port() -> int:

def discover_apps(self) -> list[TrameApp]:
"""
Search the system for trame apps that can be launched with JuViz.
Search the system for trame apps that can be launched.
The default behavious will rely on the `JUPYTER_PATH`environment variable, where trame apps will be found in
`trame/<app_name> directories`.

Expand Down Expand Up @@ -68,7 +69,7 @@ def parse_app_config(self, path) -> TrameApp:

- name: The display name of the app to be shown in the UI
- command: The shell command that will be executed to lauch an instance for this trame app
This command must append the $JUVIZ_ARGS environment variable to the python script, which provides
This command must append the $TRAME_INSTANCE_ARGS environment variable to the python script, which provides
some information for trame. See L{Configuration.generate_trame_env} for the generation of the variable.
- working_directore: Optional, location here I{command} will be executed.

Expand Down Expand Up @@ -135,17 +136,17 @@ def generate_trame_parameters(self, app: TrameApp) -> dict:

def generate_trame_env(self, instance: TrameAppInstance) -> dict:
"""
Generated the environment used by the trame instance. This environment contains the $JUVIZ_ARGS variable, that
Generated the environment used by the trame instance. This environment contains the $TRAME_INSTANCE_ARGS variable, that
passes information, e.g., the port, to trame.

@param instance: A reference to the trame instance that will be launched
@return: The generated environment
"""
env = os.environ.copy()
env["JUVIZ_ARGS"] = (f"--port={instance.port} "
f"--data={instance.data_directory} "
f"--authKeyFile={instance.auth_key_file} "
f"--server")
env["TRAME_INSTANCE_ARGS"] = (f"--port={instance.port} "
f"--data={instance.data_directory} "
f"--authKeyFile={instance.auth_key_file} "
f"--server")
return env

def route_trame(self, instance: TrameAppInstance, server_app: ServerApp) -> str:
Expand Down Expand Up @@ -198,8 +199,8 @@ async def launch_trame(self, app: TrameApp, server_app, **options) -> TrameAppIn
@abstractmethod
async def get_running_servers(self) -> list[ParaViewServer]:
"""
Get the list of currently running ParaView Servers that were launched by JuViz. This information can, e.g., be
fetched from the job scheduler.
Get the list of currently running ParaView Servers that were launched via the extension. This information can,
e.g., be fetched from the job scheduler.

@return: A list of all ParaView Servers
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def get_running_servers(self) -> list[ParaViewServer]:
]

async def launch_paraview(self, options) -> tuple[int, str]:
raise RuntimeError("Can't launch ParaView via JuViz on Desktop")
raise RuntimeError("Can't launch ParaView on Desktop")

async def get_user_data(self) -> UserData:
home = os.path.expanduser("~")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def launch_paraview(self, options: dict) -> tuple[int, str]:
raise ValueError(f"Unkown Partition: {options['partition']}")

# Create a tempfile and write the SLURM Config and log files into it
temp_dir = Path(os.getenv("SCRATCH"), "juviz-jobs")
temp_dir = Path(os.getenv("SCRATCH"), "trame-manager-jobs")
temp_dir.mkdir(parents=True, exist_ok=True)

job_dir = Path(mkdtemp(prefix=os.getenv("USER"), dir=temp_dir))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def setup_handlers(web_app: ServerWebApplication, model):
base_url = url_path_join(web_app.settings["base_url"], "jupyter-viz-extension")
base_url = url_path_join(web_app.settings["base_url"], "trame-manager")
web_app.add_handlers(".*$", [
(url_path_join(base_url, "paraview"), ParaViewHandler, dict(model=model)),
(url_path_join(base_url, "trame"), TrameHandler, dict(model=model)),
Expand Down
Loading
Loading