2 VSCode: Code Editor
Visual Studio Code (VSCode) is a popular, lightweight code editor that supports a wide range of programming languages, including Python. It offers a rich ecosystem of extensions that enhance its functionality, making it an excellent choice for Python development.
To set up VSCode for Python development, follow these steps:
Install VSCode: Download and install VSCode from the official website.
Install the Python Extension: Open VSCode and go to the Extensions view by clicking on the Extensions icon (
) in the Activity Bar on the left side of the window or by pressing
Ctrl+Shift+X. Search for the “Python” extension provided by Microsoft and install it. This Python extension will automatically install the following three additional extensions to provide the best Python development experience in VS Code:- Pylance – performant Python language support
- Python Debugger – seamless debug experience with debugpy
- Python Environments – dedicated environment management
Install Additional Extensions: Depending on your workflow, you may want to install additional extensions such as:
- Jupyter: Enables you to work with Jupyter Notebooks directly within VSCode.
- GitHub Copilot: AI-powered coding tool.
- GitHub Pull Requests: Manage GitHub pull requests and issues directly from VSCode.
- GitLens: Enhances Git capabilities within VSCode.
- Ruff: Fast Python linter and code formatter. (See the ruff: Linter and Formatter chapter)
You can open your Python project in VSCode by navigating to File > Open Folder and selecting the project directory. VSCode will automatically detect the Python environment and provide features such as IntelliSense, linting, debugging, and code navigation.
For more information on setting up and using VSCode for Python development, refer to the Python in Visual Studio Code section in the official VSCode documentation.