What's new in Elyra 2.0
Tags: jupyter, datascience, python
Published: 2021-02-01 22:39:19

Earlier this month [JupyterLab 3.0 was released](https://blog.jupyter.org/jupyterlab-3-0-is-out-4f58385e25bb), providing a slew of new features. In this blog post, I recap a few highlights and how the Elyra 2.0 extensions take advantage of them. 

> New to Elyra? Take a look at the [overview documentation](https://elyra.readthedocs.io/en/latest/getting_started/overview.html). TL;DR: Elyra provides productivity features for common data science and AI tasks.

#### Support for Language Servers

Many modern integrated development environments (IDEs) simplify development by providing editor features like autocomplete, "go to definition", "find references", or linting. 

JupyterLab optionally supports these features by integrating with [Language Servers](https://microsoft.github.io/language-server-protocol/) using the [`jupyterlab-lsp` extension](https://github.com/krassowski/jupyterlab-lsp). Language Servers are available for [many languages](https://jupyterlab-lsp.readthedocs.io/en/latest/Language%20Servers.html), including Python and R. Note that some Language Servers might not support every convenience feature.

Elyra 2.0 includes the [Python Language Server](https://pypi.org/project/python-language-server/), enabling these features in the notebook editor and Python script editor, as shown below.

![Lint code, use auto-complete, open signature preview, find references and more using the Python Language Server integration](https://dev-to-uploads.s3.amazonaws.com/i/xzfier3nrsuogxpbfpfb.gif)

You can add support for other languages by [installing the appropriate Language Server](https://jupyterlab-lsp.readthedocs.io/en/latest/Language%20Servers.html) and its prerequisites.

#### Visual debugger
JupyterLab includes a [visual debugger front-end](https://jupyterlab.readthedocs.io/en/stable/user/debugger.html) that provides common debugging tasks. For example, you can set breakpoints,  step through code, or inspect data. The front-end requires a kernel with support for debugging.

As of January 2021, the only Jupyter Python kernel that supports debugging is [`xeus-python`](https://github.com/jupyter-xeus/xeus-python).

> Note that this kernel currently does not support all iPython features, such as cell magics.

Neither JupyterLab 3.0 nor Elyra 2.0 install `xeus-python` by default. You therefore have to install it separately from PyPI, conda, or build from source code.
 
#### Debugging a notebook

To debug a notebook, associate it with a kernel that supports debugging and enable the debugger. The official [debugger example Python notebook](https://github.com/jupyterlab/debugger/blob/master/examples/index.ipynb) provides a short introduction and is highly recommended!

![Debug notebooks using debugger-enabled kernels](https://dev-to-uploads.s3.amazonaws.com/i/4dbwe094oa8j9u7jbc8y.png)

#### Debugging a Python script

Elyra's [Python editor](https://elyra.readthedocs.io/en/latest/user_guide/enhanced-python-support.html) is also enabled for debugging. To debug a Python script: 

1. Open the script in the Python editor.
1. Right click on the canvas and select `Create Console for Editor`.
1. Select a kernel that supports debugging.
1. Enable the debugger in the console.
1. Set one or more breakpoints in the source code.
1. Run code to breakpoint and step through the code.

![Debug a Python script using the debugger](https://dev-to-uploads.s3.amazonaws.com/i/vg09kpnhk1yul7mb7b04.gif)

Elyra 2.0 also includes several enhancements that are not specific to JupyterLab 3.0.

### Pipeline editor enhancements for Kubeflow Pipelines

Elyra's visual pipeline editor, which I introduced in [this blog post](https://dev.to/ibmdeveloper/automate-your-machine-learning-workflow-tasks-using-elyra-and-kubeflow-pipelines-5d6n), was extended to support custom resource allocation and the Tekton workflow engine.

> Editor's note: Time flies! Elyra 2.1 (and later versions) also support [running pipelines on Apache Airflow](https://dev.to/ibmdeveloper/automate-your-machine-learning-workflow-tasks-using-elyra-and-apache-airflow-1kpa).

#### Customize resource allocation

When a pipeline node is executed on Kubeflow Pipelines, it is processed in a container. The amount of CPU, GPU, and memory (RAM) resources that are allocated for the container is governed by configuration settings in Kubernetes.

With the latest enhancement in Elyra, you can request additional CPU, GPU, or memory resources to speed up processing of your notebook or Python script during pipeline execution. You configure those resource requirements in the node's properties view:
1. Select the notebook or Python script node in the pipeline editor.
1. Right click, and select `Properties`.
1. Enter the desired values.

![custom_resource_requirements](https://dev-to-uploads.s3.amazonaws.com/i/vgdbd07c8ocyncyqb9n7.png)

If you leave the properties empty, the Kubernetes default settings are applied.

#### Support for Tekton workflow engine

Kubeflow Pipelines utilizes a container-native workflow engine to execute pipelines. As of January 2021,  [Argo](https://github.com/argoproj/argo) and [Tekton](https://github.com/kubeflow/kfp-tekton) are the only two supported engines. 

When you run (or export) a pipeline in the Elyra pipeline editor, it is compiled into a workflow engine-specific format. In previous releases, Elyra could only produce Argo-compatible outputs, but this restriction is lifted in version 2.0. Since Elyra cannot automatically determine which workflow engine your Kubeflow Pipelines installation leverages, you need to specify the type when you [create a runtime configuration for your Kubeflow Pipelines deployment](https://elyra.readthedocs.io/en/latest/user_guide/runtime-conf.html).

![runtime_configuration_engine_type](https://dev-to-uploads.s3.amazonaws.com/i/r2ty32o8a5cjiq2ugn12.png)
 

If you don't specify an engine type in your configuration, Argo is assumed as default to retain backward compatibility with older Elyra releases. 

> If you are unsure what engine your Kubeflow Pipelines deployment utilizes, check with the administrator. If you select the wrong engine type, your pipelines will fail to execute.

### Code snippets

Elyra 2.0 makes it easier to create code snippets. The [code snippet editor](https://elyra.readthedocs.io/en/latest/user_guide/code-snippets.html) now allows for the creation of code snippets from highlighted code.
 
To create a code snippet within an editor, select the desired piece of code, right click, and choose from the context menu `Save as Code Snippet`.

![Create a code snippet from code, paste it as a new cell and run it](https://dev-to-uploads.s3.amazonaws.com/i/cvkcdrns3n53z5or85nx.gif)

To learn more about other enhancements or bug fixes that went into Elyra 2.0 please check the [changelog](https://elyra.readthedocs.io/en/latest/getting_started/changelog.html).

### Get started

If you are new to Elyra, it's easy to get started.

#### Install from PyPI or conda

You can install the Elyra JupyterLab extensions from PyPI, conda, or from source code. Refer to the [installation guide](https://elyra.readthedocs.io/en/latest/getting_started/installation.html#installation) for details.

> JupyterLab 3.0 introduces a new extension type named [_prebuilt extensions_](https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html#overview-of-extensions). These extensions don't need a JupyterLab rebuild or a Node.js installation. Unfortunately, we are unable to distribute Elyra 2.0 as prebuilt extensions, but are considering doing it for future releases.

 
#### Run JupyterLab/Elyra in a container image

The Elyra community publishes Elyra container images on DockerHub and Quay.io. Take a look at [these instructions](https://elyra.readthedocs.io/en/latest/getting_started/installation.html#docker) to learn more about the images and how to run them.

The Elyra community publishes Elyra container images on DockerHub and Quay.io. Take a look at [these instructions](https://elyra.readthedocs.io/en/latest/getting_started/installation.html#docker) to learn more about the images and how to run them.

### Get involved

During the past year we have received many suggestions and feedback from users like you. We appreciate your input and encourage you to stay involved. Open [GitHub issues](https://github.com/elyra-ai/elyra/issues), reach out on [gitter](https://gitter.im/elyra-ai/community), post in our [new forum](https://github.com/elyra-ai/elyra/discussions), or join our [weekly community meeting](https://elyra.readthedocs.io/en/latest/getting_started/getting-help.html#join-the-weekly-community-meeting).

Use the forum to ask general questions or share things you've created, like [Nick Burdakous did](https://github.com/elyra-ai/elyra/discussions/1208). He recently published a pipeline viewer for [Google Chrome](https://chrome.google.com/webstore/detail/elyra-pipeline-viewer/blomglkicbbfkbmppeljdnnakajnpnop) and [Mozilla Firefox](https://addons.mozilla.org/en-US/firefox/addon/elyra-pipeline-viewer/). This viewer visualizes pipeline files on GitHub, like shown in the screen shot below. The [depicted pipeline](https://github.com/CODAIT/flight-delay-notebooks) was created by Nick Pentreath and presented at the [Big Things conference in November 2020](https://www.youtube.com/watch?v=BFX0s4qr7HU).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ca2wtv49jj9gh1attctd.png)


The Elyra community has lot planned for the first half of this year. Follow us here on [dev.to/ibmdeveloper](https://dev.to/ibmdeveloper) or on [Twitter](https://twitter.com/codait_org) to stay in the loop.