Hi I'm Dan Taylor a Principal PM Manager for our Python developer tools at Microsoft
Today the Visual Studio Code team is announcing Visual Studio Code Remote
Which allows Visual Studio Code to run in remote workspaces
in Docker environments, Windows Subsystem for Linux, or over an SSH connection
The way this works, is that Visual Studio Codes UI runs on your local machine
and then connects to a remote server which hosts your extensions, this means that
all of the capabilities you would use in your local environment, such as debugging,
your terminal, source control, they all work against the remote workspace
I've been playing with this capability and I'd like to take you through a tour of how it works
Let's dive right in
I published this sample tweeter application to GitHub, which is a Django, React and Postgres
application that we're going to open in a Dockerized development environment
using Visual Studio Code Remote
I've cloned and opened it up with Visual Studio Code insiders and we can see our docker
development environment is defined by this devcontainer.json file, which points at a
docker compose file that defines the services in our development environment
you can see we've got an application service this will contain a Python and Node runtime
as well as a database container that uses Postgres
to open up this development environment we can click open a remote window in the bottom
left hand corner and select the Reopen folder in container command
Visual Studio Code will then reload and then start building
docker containers defined by the docker compose files. It will then start a
Visual Studio Code remote server, which will host our extensions and allows us to
work remotely inside of this Docker container environment. I can create a new terminal,
which will then run inside of the Docker container and I can
building my Node.js front end by running npm run dev
I can also set breakpoints and start debugging
if I click in the debug activity bar and click play
that will start up the debugger and launch our app on port 8000
port 8000 is mapped out to our local machine site and so I can then open up my browser
and view this application in my browser
and I can I'm also stopped on the breakpoint, and I can inspect variables and
do everything that would work locally. So I can type request and get completions here and
look at request.user and I can expand that variable that in the debug console
I can do full debugging here inside the container
I can also use IntelliSense for example if I open up my models file and start typing
I get my IntelliCode auto-completions because I've got the IntelliCode extension installed
showing me the top five recommendations from this giant completion list
I can open up my tests and then I can run unit tests here inside of the container
I can see here that my test had passed
Now let's take a quick look at how Visual Studio Code Remote enables us to work
in Windows Subsystem for Linux, or WSL for short, to get started with WSL for short
I can type WSL from from my windows command prompt
and now I'm running in a bash command prompt that's
running on top of Linux image running on top of the Windows kernel. Now I can go to my
dev folder where I've got a sample application that I want to work with and to get started
with this I can simply type code-insiders . from the command prompt and that will
launch Visual Studio Code remote running inside of the WSL system
it will then start up the VS Code remote server and then connect the UI on my desktop
to that server so I can start developing
as if I was developing on my local desktop machine. I can open up files,
I can hover over variables, and I can even start debugging. So debug > start debugging
I'll select the current file, and it will run this script
This script downloads and analyzes data
from Stack Overflow surveys over the past few years, so I've set a breakpoint here
and we can step through each year of analysis. So it'll run one iteration of the loop
we can download the 2011 survey and I can look at the totals that are in for that, year I can
see that the values of the various languages over time and I can just keep running
and running through this
Now let's dive in to using Visual Studio Code remote
to develop on a remote Virtual Machine over an SSH connection
Here I've got this deep learning VM running in Azure, it's running on a Linux operating system
It has 6 cores, and 56 gigs of RAM, as well as a GPU
to develop against this we'll open the remote SSH activity bar and then we will
configure our connections, and I've already got this
deep learning VM set up here with just the hostname and my username
and I have my SSH public-private key set up here so I can just click the connect host button
and a new instance of visual studio code will open that will be running remotely
inside of that VM. Once this opens I can open a folder on the remote system.
this VM comes with a bunch of pre-made in this notebooks folder
so we'll click OK and open that as our workspace
and then let's take a look at some of the notebooks that are available
I'm going to open up this fully connected .ipynb the notebook
and I'm going to import to Jupyter notebook
which will then load the Python extension running on the virtual machine
It's using a Conda environment as indicated by the Conda name in the status bar there
I can then just run all of the cells here in order to to use the Python interactive window
and see the interactive output as I train the machine learning model
you can see it its training of the initials of steps there
and finally we see a train to about 85% accuracy. Now we can
open up our terminal which is running on the remote machine
and then we can type nvidia-smi to see that we were using about 12 gigs of
GPU memory during the training process
That was a quick tour of Visual Studio Code Remote, and I am excited for the new
capabilities that this unlocks for Visual Studio Code developers
and Python developers in particular
Be sure to try it out today by visiting aka.ms/vscode-remote. Thank you for watching!