Coconote
AI notes
AI voice & video notes
Export note
Try for free
Setting Up Visual Studio Code for Python Development
Jul 13, 2024
Lecture Notes: Setting Up Visual Studio Code for Python Development
Introduction
Objective:
Learn how to install Visual Studio Code (VS Code), set up a Python development environment, and explore its features.
Target Audience:
Python developers
Host Mention:
Talk Python podcast with Michael Kennedy
Focus Shift:
Increasing popularity of VS Code among developers
Installation and Initial Setup
Visual Studio Code Installation
Access Website:
code.visualstudio.com
Download and Install:
Follow standard software installation procedures
Accept terms
Select install location
Create desktop icon
Launch application post-installation
Initial Launch
Welcome Screen:
Offers resources and guidance
Activity Bar:
Main navigation tool with icons which includes Explorer, Search, Git Integration, Debugging, and Extensions
Icons Information:
Hover to get a description
Setting Up Extensions
Managing Extensions
Python Extension:
Most popular with 42.2 million downloads; offers linting, debugging, formatting, unit testing, and IntelliSense
Install Extensions:
Provides functionalities such as code linting, syntax highlighting, etc.
Initial Python Script
Open Folder:
Navigate to project folder
Sample Python Script:
Demonstrates print statements, function creation, and version information
Running Script:
Use
Run Python File in Terminal
Check Python interpreter
Example of switching between Python 2 and Python 3
Integrated Terminal:
Can run scripts directly in the VS Code terminal
Creating and Using Virtual Environment:
Demonstration using
venv
module
Customizing VS Code
Settings Adjustments
Color Themes and Icons:
Use built-in options or install new ones
User Settings JSON:
Modify settings directly using JSON format for better control
Python Path Configuration:
Ensure correct interpreter is being used by default for all projects
Extensions Management and Usage
Formatter (Black/Auto PEP8):
Automatic formatting of Python code using keyboard shortcuts
Linting:
Pilant installed for checking code for potential errors
Code Runner:
Allows running code using keyboard shortcuts instead of right-click
Using Git and GitHub Integration
Initialize Repository:
Set up git tracking for project folder
Gitignore File:
Ignore specific directories
Commit Changes:
Stage and commit files
Push to GitHub:
Set up remote repository and push changes via terminal
Debugging Features
Setting Breakpoints
Debug Tab:
Set configurations for debugging Python files
Interactive Debug Console:
Inspect current values and expressions at breakpoints
Local Variables and Watch:
Monitor changes and variables during debugging
Unit Testing Integration
Discover and Run Tests
Test Frameworks:
Support for PyTest and Unittest
Running Tests:
Can run individual tests or the entire suite
Testing Tab:
Provides visual feedback on test statuses
Additional Tips
Zen Mode
Distraction-Free Coding:
Minimalist setup to focus on code
Custom Shortcuts:
Open command palette to explore various shortcuts
Conclusion
Summary:
Overview of VS Code features customized for Python development
Feedback and Support:
Encourage viewers to ask questions and support the channel via likes, shares, and Patreon
📄
Full transcript