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

Develop Elyra against the Jupyterlab source repo #2709

Merged
merged 6 commits into from
May 13, 2022
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
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Build
run: |
pip install "jupyterlab>=3.4.0"
make build-dependencies
make yarn-install
make build-ui
Expand Down Expand Up @@ -143,6 +144,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Build
run: |
pip install "jupyterlab>=3.4.0"
make build-dependencies
make yarn-install
make build-ui
Expand Down
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
.PHONY: help purge uninstall-src uninstall clean
.PHONY: lint-dependencies lint-server black-format prettier-check-ui eslint-check-ui prettier-ui eslint-ui lint-ui lint
.PHONY: dev-link dev-unlink
.PHONY: build-dependencies yarn-install build-ui package-ui build-server install-server-package install-server
.PHONY: install install-all install-examples install-gitlab-dependency check-install watch release
.PHONY: build-dependencies yarn-install build-ui package-ui package-ui-dev build-server install-server-package install-server
.PHONY: install install-all install-dev install-examples install-gitlab-dependency check-install watch release
.PHONY: test-dependencies pytest test-server test-ui-unit test-integration test-integration-debug test-ui test
.PHONY: docs-dependencies docs
.PHONY: elyra-image publish-elyra-image kf-notebook-image publish-kf-notebook-image
Expand Down Expand Up @@ -128,12 +128,14 @@ lint: lint-ui lint-server ## Run linters
## Library linking targets

dev-link:
yarn link @elyra/pipeline-services
yarn link @elyra/pipeline-editor
- yarn link @elyra/pipeline-services
- yarn link @elyra/pipeline-editor
- lerna run link:dev

dev-unlink:
yarn unlink @elyra/pipeline-services
yarn unlink @elyra/pipeline-editor
- yarn unlink @elyra/pipeline-services
- yarn unlink @elyra/pipeline-editor
- lerna run unlink:dev
yarn install --force

## Build and install targets
Expand All @@ -150,6 +152,8 @@ build-ui: # Build packages

package-ui: build-dependencies yarn-install lint-ui build-ui

package-ui-dev: build-dependencies yarn-install dev-link lint-ui build-ui

build-server: # Build backend
$(PYTHON) -m setup bdist_wheel sdist

Expand All @@ -165,6 +169,8 @@ install: package-ui install-server check-install ## Build and install

install-all: package-ui install-server install-examples install-gitlab-dependency check-install ## Build and install, including examples

install-dev: package-ui-dev install-server install-examples install-gitlab-dependency check-install

install-examples: ## Install example pipeline components
# install Kubeflow Pipelines example components
# -> https://github.com/elyra-ai/examples/tree/master/component-catalog-connectors/kfp-example-components-connector
Expand Down
1 change: 0 additions & 1 deletion build_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
jupyterlab>=3.0.17
jupyter-packaging>=0.10
35 changes: 34 additions & 1 deletion docs/source/developer_guide/development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ To specify a JupyterLab version to be installed:

You can install Elyra using a local build of @elyra/pipeline-editor with:
```bash
make clean dev-link install
make clean install-dev
```

### Back-end Development
Expand Down Expand Up @@ -195,3 +195,36 @@ or you can checkout the respective tagged release and omit the `TAG` parameter.

Official container images are published on [Docker Hub](https://hub.docker.com/r/elyra/elyra/tags)
and [quay.io](https://quay.io/repository/elyra/elyra?tab=tags).

### Developing Elyra against the Jupyterlab source repo

Sometimes it is useful to develop Elyra against a local build of Jupyterlab. To use a local build of Jupyterlab use the
following steps in the same python environment.

1. Uninstall any pip installations of Jupyterlab. You can use `etc/scripts/clean-jupyterlab.sh --version dev` as
mentioned above with `--version dev` to not reinstall Jupyterlab at the end of the script.

2. Build your local repo of Jupyterlab, step-by-step instructions can be found in the
[Jupyterlab documentation](https://jupyterlab.readthedocs.io/en/latest/developer/contributing.html#installing-jupyterlab).
Uninstalling in the previous step will also wipe any previous installations of a local build.

3. `cd` to the `builder/` directory in your Jupyterlab repo and run `yarn link`. The Elyra `Makefile` will use this yarn
link in step 6.

4. In your Elyra repo, uncomment the following line in `tsconfig.base.json` to tell Typescript to use the local
Jupyterlab packages when building:

```"paths": { "@jupyterlab/*": ["../jupyterlab/packages/*"] },```

5. Comment out `jupyterlab` and `jupyterlab-lsp` in the `install_requires` section of `setup.py` in your Elyra repo.
This will prevent Jupyterlab from being pip installed during the Elyra build.
Note: `jupyterlab-lsp` also pip installs Jupyterlab when installed

6. Run `make install-dev` to install Elyra using the linked `@jupyterlab/builder` from step 3.
ajbozarth marked this conversation as resolved.
Show resolved Hide resolved

7. You can now start Jupyterlab by running `jupyter lab --dev-mode --extensions-in-dev-mode`, this will automatically
watch for changes in the Jupyterlab repo. To also watch for changes in Elyra run `make watch` in a separate terminal
in the same Python environment.

When you want to switch back to developing Elyra against a Jupyterlab release, you just have to undo the comments in
steps 4 and 5 and rebuild with `make clean install`
4 changes: 3 additions & 1 deletion etc/config/settings/page_config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"disabledExtensions": ["@jupyterlab/launcher-extension"]
"disabledExtensions": {
"@jupyterlab/launcher-extension": true
}
}
26 changes: 15 additions & 11 deletions etc/scripts/clean-jupyterlab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ echo " "
echo "Installing/Updating JupyterLab"
pip install --upgrade pip wheel
pip install --upgrade tornado
pip install --upgrade "jupyterlab$LAB_VERSION"
if [ "$LAB_VERSION" != "==dev" ]
then
pip install --upgrade "jupyterlab$LAB_VERSION"
fi
echo " "

echo "Installing Xeus kernel"
Expand All @@ -97,13 +100,14 @@ conda install -y r r-essentials r-irkernel
conda install -y -c conda-forge r-languageserver
echo " "

jupyter --version
echo " "
jupyter kernelspec list
echo " "
jupyter serverextension list
echo " "
jupyter server extension list
echo " "
jupyter labextension list
echo " "
if [ "$LAB_VERSION" != "==dev" ]
then
jupyter --version
echo " "
jupyter kernelspec list
echo " "
jupyter server extension list
echo " "
jupyter labextension list
echo " "
fi
4 changes: 3 additions & 1 deletion packages/code-snippet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"lab:install": "jupyter labextension install --no-build",
"lab:uninstall": "jupyter labextension uninstall --no-build"
"lab:uninstall": "jupyter labextension uninstall --no-build",
"link:dev": "yarn link @jupyterlab/builder",
"unlink:dev": "yarn unlink @jupyterlab/builder"
},
"dependencies": {
"@elyra/metadata-common": "3.9.0-dev",
Expand Down
4 changes: 3 additions & 1 deletion packages/code-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"lab:install": "jupyter labextension install --no-build",
"lab:uninstall": "jupyter labextension uninstall --no-build"
"lab:uninstall": "jupyter labextension uninstall --no-build",
"link:dev": "yarn link @jupyterlab/builder",
"unlink:dev": "yarn unlink @jupyterlab/builder"
},
"dependencies": {
"@jupyterlab/application": "^3.4.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/metadata-common/src/MetadataEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,7 @@ export class MetadataEditor extends ReactWidget {
''}`;
}
const error = this.displayName === '' && this.invalidForm;
const onKeyPress: React.KeyboardEventHandler = (
event: React.KeyboardEvent
) => {
const onKeyPress = (event: React.KeyboardEvent<HTMLDivElement>): void => {
const targetElement = event.nativeEvent.target as HTMLElement;
if (event.key === 'Enter' && targetElement?.tagName !== 'TEXTAREA') {
this.saveMetadata();
Expand Down
4 changes: 3 additions & 1 deletion packages/metadata/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"lab:install": "jupyter labextension install --no-build",
"lab:uninstall": "jupyter labextension uninstall --no-build"
"lab:uninstall": "jupyter labextension uninstall --no-build",
"link:dev": "yarn link @jupyterlab/builder",
"unlink:dev": "yarn unlink @jupyterlab/builder"
},
"dependencies": {
"@elyra/metadata-common": "3.9.0-dev",
Expand Down
4 changes: 3 additions & 1 deletion packages/pipeline-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"lab:install": "jupyter labextension install --no-build",
"lab:uninstall": "jupyter labextension uninstall --no-build"
"lab:uninstall": "jupyter labextension uninstall --no-build",
"link:dev": "yarn link @jupyterlab/builder",
"unlink:dev": "yarn unlink @jupyterlab/builder"
},
"dependencies": {
"@elyra/metadata-common": "3.9.0-dev",
Expand Down
4 changes: 3 additions & 1 deletion packages/python-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"lab:install": "jupyter labextension install --no-build",
"lab:uninstall": "jupyter labextension uninstall --no-build"
"lab:uninstall": "jupyter labextension uninstall --no-build",
"link:dev": "yarn link @jupyterlab/builder",
"unlink:dev": "yarn unlink @jupyterlab/builder"
},
"dependencies": {
"@elyra/script-editor": "3.9.0-dev",
Expand Down
4 changes: 3 additions & 1 deletion packages/r-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"lab:install": "jupyter labextension install --no-build",
"lab:uninstall": "jupyter labextension uninstall --no-build"
"lab:uninstall": "jupyter labextension uninstall --no-build",
"link:dev": "yarn link @jupyterlab/builder",
"unlink:dev": "yarn unlink @jupyterlab/builder"
},
"dependencies": {
"@elyra/script-editor": "3.9.0-dev",
Expand Down
4 changes: 3 additions & 1 deletion packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"lab:install": "jupyter labextension install --no-build",
"lab:uninstall": "jupyter labextension uninstall --no-build"
"lab:uninstall": "jupyter labextension uninstall --no-build",
"link:dev": "yarn link @jupyterlab/builder",
"unlink:dev": "yarn unlink @jupyterlab/builder"
},
"dependencies": {
"@elyra/ui-components": "3.9.0-dev",
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
data_files_spec = [
("etc/jupyter/jupyter_notebook_config.d", "etc/config/jupyter_notebook_config.d", "*.json"),
("etc/jupyter/jupyter_server_config.d", "etc/config/jupyter_server_config.d", "*.json"),
("etc/jupyter/labconfig", "etc/config/settings", "*.json"),
("share/jupyter/metadata/runtime-images", "etc/config/metadata/runtime-images", "*.json"),
("share/jupyter/metadata/component-catalogs", "etc/config/metadata/component-catalogs", "*.json"), # deprecated
("share/jupyter/components", "etc/config/components", "*.json"), # deprecated
("share/jupyter/components/kfp/", "etc/config/components/kfp", "*.yaml"), # deprecated
("share/jupyter/components/airflow/", "etc/config/components/airflow", "*.py"), # deprecated
("share/jupyter/lab/settings", "etc/config/settings", "*.json"),
("share/jupyter/labextensions", "dist/labextensions", "**"),
]

Expand Down Expand Up @@ -75,9 +75,9 @@
"jupyter_client>=6.1.7",
"jupyter-packaging>=0.10",
"jupyter_server>=1.7.0",
"jupyterlab>=3.4.0",
"jupyterlab>=3.4.0", # comment out to use local jupyterlab
"jupyterlab-lsp>=3.8.0", # comment out to use local jupyterlab
"jupyterlab-git~=0.32", # Avoid breaking 1.x changes
"jupyterlab-lsp>=3.8.0",
"jupyter-resource-usage>=0.5.1",
"MarkupSafe>=2.1",
"minio>=7.0.0",
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,

/* Uncomment to use local jupyterlab instance */
// "paths": { "@jupyterlab/*": ["../jupyterlab/packages/*"] },

/* Logging */
"preserveWatchOutput": true
}
Expand Down