New Features

Jupyter 4.x Plugin to export Notebooks to Onesait Platform

We have created a plugin for JupyterLab 4.x that will allow us to export one or more Notebooks to Onesait Platform quickly and easily.

As users, we will be able to configure in the JupyterLab properties the URL of the environment and the access token needed to connect to Onesait Platform, as well as to configure other optional properties.

This plugin is available for direct download as well as in PyPi, and in the future we will include it in the JupyterLab extensions repository.

How to install it

As mentioned above, this plugin can currently be installed in two ways.

From PyPi

This is the typical way of installation at developer level. From the root of the folder where we have installed our JupyterLab, we will install the package using pip:

pip install onesait_platform_jupyter4

By installing the wheel package

In case of working without internet connection, to install this plugin we will download the wheel package.

We recommend saving the file in the root of your Jupyter Lab project:

Once saved, we can install it like any other package using pip:

pip install onesait_platform_jupyter-0.1.0-py3-none-any-whl

How to use it

Once installed, in the case of PyPi or the wheel package, launch JupyterLab:

jupyter lab

Configuration

Once the plugin is installed, first of all we will have to configure the environment and token of the Platform with which we want to interact.

To do this, navigate to the JupyterLab properties from the Settings > Settings Editor menu.

Once the properties window opens, we will navigate in the options column until we find the one called “Onesait Platform“. We can also use the search engine to filter the results.

By selecting this option, we will be able to view the different configurable properties:

  • Onesait Platform URL: where we will have to include the URL of the Platform to which we will connect (for example: lab.onesaitplatform.com).
  • Onesait Platform Token: valid token to connect to the Control Panel API.
  • Overwrite Notebooks: if activated, existing Notebooks with the same name in the Platform will be overwritten by those exported from JupyterLab.
  • Import Authorizations: this property has no effect at the moment, so we can leave it as it is.

Once the properties have been configured, the plugin is ready for use.

In case we try to use the plugin functionalities without having defined this information, we will get a notification that the plugin needs to be configured:

Exporting a Notebook

To export a Notebook, select the Notebook you want to export from the file manager and open the context menu with the right mouse button. From the different options, select “Export to Onesait Platform”.

Then a modal will appear for us to confirm that we want to export this Notebook:

If the export is successful, a notification will appear showing the ID created in Onesait Platform.

If we go to Onesait Platform, in the Notebooks list we will see the Notebook we have imported. To access the list, navigate to the Analytics Tools> Notebooks Management menu.

Accessing the Notebook, we will check that the content is the one created in JupyterLab:

If, on the other hand, an error occurs when exporting the Notebook, a different notification will appear in JupyterLab warning about it.

Exporting Notebooks in Stack

To export several Notebooks, we can invoke a command that will allow us to select several of them and send them to the Platform. To do this, access the launcher from the View > Activate Command Palette menu.

In the command finder, start typing “Onesait Platform” until you find the command “Onesait Platform: Export Notebooks…“.

This will open a local file search window, where we will be able to select one or more Notebooks, which will be exported to Onesait Platform.

Although it is possible to select files that are not Notebooks, only those that are Notebooks as such will be exported.

Once the Notebooks have been selected, if the export is successful, a notification will be displayed for each Notebook indicating that the export has been successful.


Header Image: Kelly Sikkema at Unsplash; little hearts icons from FlatIcon.

✍🏻 Author(s)

Leave a Reply

Your email address will not be published. Required fields are marked *