Visual Studio Code

From Wildsong
Revision as of 21:14, 21 March 2020 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

where does it ever end? Komodo -> Microsoft Visual Studio -> Atom -> Visual Studio Code

I am now learning Visual Studio Code

I am currently using VSC to edit Python to create Geoprocessing scripts that I can run in Docker containers.

It's not finding Python!!

Here is a doc telling where it looks.

Work around the problem

On Murre this was a problem. It's seeing non-existent ArcMap pythons and the emacs python but not the one WindowsApps installed. But the Powershell it launches can see it. So in the Powershell I created a virtual environment and told it to use that.

python3 -m venv .venv

Remote development

I've now tried this tutorial and learned it works. Python in a Container I got a simple Flask app running and then switched to running even simpler Python scripts in the container.

When I needed to add volume support I discovered this page: VS Code Remote Development It explains the Remote Development extension pack.

  • I can use Remote - SSH to treat a remote machine (say, Bellman) as the host for a remote project. (* As recommended by John Sullivan.)
  • I can use Remote - Containers to treat a Docker container as the host.
  • I can use Remote - WSL too but I don't use Windows Subsystem for Linux currently.

Docker containers

I can keep the code on the local file system or in the container.

My first tests I used the Dockerfile to load my code into the image. It worked fine.

More options:

  • clone from github into a running container
  • keep code in a volume mounted on the container

Using a volume seems to make the most sense to me. In that setting I can still easily use command line git.

There is a sample based on python, it starts a Debian container and puts a Bash prompt into a Terminal window. It connects when you do F5. Your code is accessible on the local filesystem and in the mounted volume in the container.

git clone https://github.com/Microsoft/vscode-remote-try-python