

It does this by complaining about all of the lines that don’t follow the style guide. There are several problems with our code not following the style guide as shown below.įlake8 helps you right code that follows the Python PEP 8 style guide. We can take a look at what these underlines mean by clicking on the warnings at the bottom of Code. If everything is working correctly, you should start to see some red underlines on the Python code for the demo.py file. You can easily switch your Python environment anytime by clicking on Anaconda 5.2.0. Now since I selected my Anaconda Python environment, I can see Anaconda 5.2.0 at the bottom of Code. I usually run at least two Python enviorments (2 and 3). Code is very good at automatically finding all of your Python environments. Then choose your desired Python environment at the top of the screen. Click on Select Python Environment on the bottom bar of Code. These errors because we haven’t selected a Python environment yet. You may see a few warnings at the bottom of the screen.

Open a terminal/prompt and install flake8. My favorite Python linter is flake8, which will help you write Python code to the pep8 style guide. A linter will help you write better code, and display possible errors before you run your code. I also like to have a spell checking extension, but that is up to you. These features include: linting, debugging, environment selection, and more. The Microsoft Python extension includes many useful features for Python development. Now search for Python in the Marketplace Extension. Go download Code and install for your system. Code includes useful features by default (keyboard column selection, indentation conversion, terminal, and so much more).Code works on multiple operating systems (Linux/Windows/Mac).Some of the reasons I like Visual Studio Code: This post will show you how to setup code, why the linting options are useful, and how to run Python scripts from code. Microsoft has created a Python extension, which includes linting (a feature that will catch errors and help you follow the PEP 8 style guide). If I were to revisit my Python course, I would spend a lecture going over setting up Code for working with Python. I highly recommend those who work with Python to consider using Code. Visual Studio Code has become my absolute favorite IDE / text editor. Charles Jekel - Visual Studio Code Python Setup ← Home About CV Subscribe Visual Studio Code Python Setup July 29, 2018
