Connecting to notebooks from your local IDE
Getting started
From your project directory, you should run:
conveyor notebook create --env ENV
When asked how you want to access your notebook, you should select the ide
option.
This command will create a Docker container with a Jupyter Server environment with your source code, dependencies, and notebooks if any exist. The created container is linked to your personal credentials and will not be visible to other users. It will also run a local proxy server allowing you to connect to this Jupyter Server from your IDE. The command will display the connection string of the newly created Jupyter Server environment to be used in your IDE.
If you close the command process, the local proxy server will no longer be active. You will need to run the following command to re-start it:
conveyor notebook ide-connect
The first time you create a notebook,
it will ask some questions in order to configure your notebook and store this configuration in the notebooks.yml
.
Subsequent creation requests will use the configuration stored or sensible defaults,
if you want to overwrite these, you can update the notebooks.yml
file or pass in the --configure
flag.
More information about the CLI command is available here.
RBAC support
A notebook is associated with a user, a project and an environment. The user should be at least a contributor on both the project and the environment in order to create the notebook and interact with it.
Administrators are able to see all the notebooks and can delete them, but they are not allowed to interact with the Jupyter Server from an IDE. This means they cannot change the notebooks or source files of other users.
Setting up your IDE
To enable notebook editing in your chosen IDE, you will most likely need to install a plugin that adds notebook support. Additionally, you will be required to provide the connection string for the remote Jupyter Server. You will see this connection string displayed during the notebook creation process. Alternatively, you can find it in the Conveyor Web UI or obtain it by running the following CLI command:
conveyor notebook ide-connect
VS Code
You will need to install the Jupyter extension from the marketplace:
Next create a .ipynb
file in your project or open an existing one.
It should be rendered properly as a notebook by the Jupyter extension:
Next, change the Jupyter server connection string here, using the value obtained above:
VS Code will prompt you that you need to restart it for the remote server to be accessed. After restarting, you should see that your local notebook file is connected to the remote Jupyter server, showing you the available kernels:
You are now ready to work on your notebook from VS Code, executing code on the remote kernel. Note that this kernel is equipped with your project source code and dependencies.
PyCharm
Jupyter notebooks are not supported in the Community Edition of PyCharm.
Make sure you have a Python interpreter set up for your PyCharm project.
Create a .ipynb
file in your project or open an existing one.
It should be rendered properly as a notebook:
Nest, install Jupyter in your Python interpreter environment:
Next, change the Jupyter server connection string here, using the value obtained above:
Make sure you include the ?token=
at the end of the URL as PyCharm requires it.
You should now see that your local notebook file is connected to the remote Jupyter server, showing you the available kernels:
You are now ready to work on your notebook from PyCharm, executing code on the remote kernel. Note that this kernel comes equipped with your project source code and dependencies.