Using VSCode(codeserver) on Google Colab

colabcode is an awesome python package since it allows us to use VSCode(codeserver) on Google Colab/Kaggle with only 3 lines.

3lines

!pip install colabcode
from colabcode import ColabCode
ColabCode(port=10000)

Tha’s it. jupyter notebook will show you a ngrok url to access VSCode.

Let me explain about those 3 lines a little bit.

Install PyPI package

!pip install colabcode

Run VSCode via colabcode

from colabcode import ColabCode
ColabCode(port=10000)

I would like to introduce a couple of parameters we can use to you.
ColabCode() can take a couple of arguments.

From https://github.com/abhishekkrthakur/colabcode/

optional arguments:
--password PASSWORD password to protect your code-server from unauthorized access
--mount_drive if you use --mount_drive, your google drive will be mounted

As you can see, port is required and the above arguments are optional. If you want to share your VSCode on Colab, maybe password may be useful.

How to Use

python

Image for post
Image for post

As you can see, what we will need to do is to open Terminal from the left corner icon. Then execute python test.py.
If you want to change the editor theme, you can do it by clicking Gear icon and select a theme.

Image for post
Image for post

nodejs

Written by

#CreativeCoding #Art #PhysicalComputing #IoT #MachineLearning #python #creativetech

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store