Blog

Python Development in Visual Studio Code

Python is the most popular, dynamic and interpreted programming language in the world. Python has been proclaimed by web developers and programmers as the best coding language owing to the simple reason that it is simple and flexible.

One of the coolest code editors available to programmers, Visual Studio Code, is an open-source, extensible, light-weight editor available on all platforms. It’s these qualities that make Visual Studio Code from Microsoft very popular, and a great platform for Python development.

In this article, you’ll learn about Python development in Visual Studio Code, including how to:

  • Install Visual Studio Code
  • Discover and install extensions that make Python development easy
  • Write a simple Python application
  • Learn how to run and debug existing Python programs in VS Code
  • Connect Visual Studio Code to Git and GitHub to share your code with the world

Installing and Configuring Visual Studio Code for Python Development

Installing Visual Studio Code is very accessible on any platform. Full instructions for Windows, Mac, and Linux are available, and the editor is updated monthly with new features and bug fixes. You can find everything at the Visual Studio Code website:

In case you were wondering, Visual Studio Code (or VS Code for short) shares almost nothing other than a name with its larger Windows-based namesake, Visual Studio.

Visual Studio Code has built-in support for multiple languages and an extension model with a rich ecosystem of support for others. VS Code is updated monthly, and you can keep up to date at the Microsoft Python blog. Microsoft even makes the VS Code GitHub repo available for anyone to clone and contribute. (Cue the PR flood.)

The VS Code UI is well documented, so I won’t rehash it here:

Visual Studio Code Configuration Files

One important thing to mention is that Visual Studio Code is highly configurable through user and workspace settings.

User settings are global across all Visual Studio Code instances, while workspace settings are local to the specific folder or project workspace. Workspace settings give VS Code tons of flexibility, and I call out workspace settings throughout this article. Workspace settings are stored as .json files in a folder local to the project workspace called .vscode.

Editing an Existing Python Project

You created a single Python file. That’s great as an example, but many times, you’ll create larger projects and work on them over a longer period of time. A typical new project work flow might look like this:

  • Create a folder to hold the project (which may include a new GitHub project)
  • Change to the new folder
  • Create the initial Python code using the command code filename.py

Visual Studio Code is one of the coolest general purpose editors and a great candidate for Python development. In this article, you learned:

  • How to install VS Code on any platform
  • How to find and install extensions to enable Python-specific features
  • How VS Code makes writing a simple Python application easier
  • How to run and debug existing Python programs within VS Code
  • How to work with Git and GitHub repositories from VS Code
  • Visual Studio Code has become my default editor for Python and other tasks, and I hope you give it a chance to become yours as well.

We offer Best Python training in Bopal, Ahmedabad.

Author

ateetagrawal

Leave a comment

Your email address will not be published. Required fields are marked *