Skip to content

a2jensen/ASPEN

Repository files navigation

jupyterlab_apod

Github Actions Status Binder

JupyterLab Extension aimed at making code reuse easier. Inspiration taken directly from Elyra code snippets.

Development Workflow

Main branch : It is the live deployed version of the extension Development branch : We will first push our changes and handle all merge conflicts within the development branch Personal Branches: Our own branches where we will handle development of our assigned task

-Each developer will have specific task(s) assigned to them.

  1. Work on your task inside your own personal branch
  2. Once your task is finished:
    • Merge development branch into your branch
    • Handle any merge conflicts
    • Once you are satisfied with the current version of your branch after merging with development, create a pull request to push it into development

Developer Setup

These commands and small paragraphs were pulled from the Jupyter Lab extension tutorial.

  • Run this command to create a named conda environment
conda create -n aspen --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=4 nodejs=20 git copier=9 jinja2-time

activate the environment

conda activate aspen

The repo has enough code in it to see it working in your JupyterLab. Run the following command to install the initial project dependencies and install the extension into the JupyterLab environment.

pip install -ve .

The above command copies the frontend part of the extension into JupyterLab. We can run this pip install command again every time we make a change to copy the change into JupyterLab. Even better, we can use the develop command to create a symbolic link from JupyterLab to our source directory. This means our changes are automatically available in JupyterLab:

jupyter labextension develop --overwrite .

Install these libraries as well:

jlpm add @lumino/widgets
jlpm add @jupyterlab/apputils @jupyterlab/application

After the install completes, open a second terminal. Run these commands to activate the jupyterlab-ext environment and start JupyterLab in your default web browser.

conda activate jupyterlab-ext
jupyter lab

Afterwords, navigate to the dev console and look for a message along the lines of "JupyterLab extension jupyterlab_apod is activated!" You should be setup now.

Instead of having to run jlpm run build and jlpm run watch, we have a make file setup. Running make build will automatically run these commands for you.

Github Commands

git pull origin // pulls latest changes from remote
git branch -r // lists all branches
git switch BRANCH_NAME // switch branches
git merge origin/BRANCH_NAME // merge specified branch into your own branch

EVEYTHING BELOW THIS WAS PRE MADE WITH THE REPO SETUP

Requirements

  • JupyterLab >= 4.0.0

Install

To install the extension, execute:

pip install jupyterlab_apod

Uninstall

To remove the extension, execute:

pip uninstall jupyterlab_apod

Contributing

Development install

Note: You will need NodeJS to build the extension package.

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
# Change directory to the jupyterlab_apod directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the jlpm build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

jupyter lab build --minimize=False

Development uninstall

pip uninstall jupyterlab_apod

In development mode, you will also need to remove the symlink created by jupyter labextension develop command. To find its location, you can run jupyter labextension list to figure out where the labextensions folder is located. Then you can remove the symlink named jupyterlab_apod within that folder.

Testing the extension

Frontend tests

This extension is using Jest for JavaScript code testing.

To execute them, execute:

jlpm
jlpm test

Integration tests

This extension uses Playwright for the integration tests (aka user level tests). More precisely, the JupyterLab helper Galata is used to handle testing the extension in JupyterLab.

More information are provided within the ui-tests README.

Packaging the extension

See RELEASE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •