JupyterHub can integrate with VSCode, which might be useful for certain situations such as research, or lab environments where keeping the files locally is preferred. This might be where predictability and consistency are desired for the runtime environments, or where you need more resources than what you have locally. In fact, Python and R don't even need to be installed on the machine at all.
Caveats to this Method
Users won't have direct access to the files inside the container. This isn't an issue if they're solely working from inside of VSCode, but you should make note of these limitations before electing to use this method:
- Professors, TA's and other Admins won't be able to access your instance to troubleshoot or review your code since you're running code from your local computer. Unless it's a very small sized class, it's likely that this method won't be the best solution for you. TAs and other admins won't be able to troubleshoot or check your work without gaining access to your personal device by either physically obtaining it, or using some other software gain remote access to your computer.
- Files and code stay local. If the data you're working with changes frequently, then it may be a challenge to constantly re-uploading and replacing data through the web interface. Likewise, there are no safeguards, like data encryption, which may be a requirement for some research datasets.
- Your work has no backup from UCSB. When you elect to use VSCode, you choose to not store data in our cloud storage, so there's no backups or redundancy for keeping your data. You'll need to ensure that you data can survive hardware failure, disaster, or theft.
How-To Setup VSCode and JupyterHub
- Download and install VSCode
- Install the VSCode JupyterHub extension. Click on the extensions on the sidebar (Or View > Extensions) , search for JupyterHub, then click on the blue install button.
- Generate an API token from your JupyterHub instance.
- Go to your JupyterHub instance and log in to the web page. The address should be something like https://example.lsit.ucsb.edu
- Edit the URI to `/hub/token` (ie: https://example.lsit.ucsb.edu/hub/token - (1) pictured above)
- Enter a note to help you identify the purpose of token at a later date ( (2) pictured above)
- Set when you want the token to expire. ( (3) pictured above)
- Generate the token by clicking on the orange "Request new API token" button ( (4) pictured above)
- Copy the API token and store it somewhere safe. (pictured below)
- Open and existing notebook OR create a notebook file by opening the Command Palette (
Ctrl+Shift+P
) and selectJupyter: Create New Jupyter Notebook
. - Open the kernel picker by clicking on the kernel picker in the top right of the notebook or by invoking the
Notebook: Select Notebook Kernel
command - Select the option
Existing JupyterHub Server...
- Follow the prompts to enter the Url of the JupyterHub Server (ie: https://example.lsit.ucsb.edu ), UCSBNetID and the API token you generated above.
- Select a kernel (python or R if the instance has rstudio available) and run your notebook.