Visual Studio Code for Python Programmers
John Wiley & Sons Inc (Verlag)
978-1-119-77336-8 (ISBN)
Visual Studio Code for Python Programmers helps Python developers become not just familiar, but productive in Visual Studio Code. To start, you’ll find the steps for installing Visual Studio Code on Windows, Mac and Linux platforms, along with an introduction to the editing features of the workspace. Coverage of more advanced functionality includes managing source code, debugging, unit testing, and Jupyter Notebook support. The book finishes with a walk-through of real-world projects which utilize Visual Studio Code features introduced in the book.
For developers, the choice of an editor is a very personal one. You have idiosyncratic needs and wants that are unique to you as a developer. This book will help you learn how to customize Visual Studio Code to meet your needs and Python development workflow.
Introduces you to the features of the Visual Studio Code workspace and how those features can be customized
Demonstrates how Visual Studio Code allows you to choose your structure according to your needs
Covers editing code in Python, including syntax highlighting, code completion, object definition, refactoring, and code navigation
Describes Git integration and how to perform common Git functions (commits, checkouts, branches, and merges) from within Visual Studio Code
Highlights debugging features for Python developers
A final section on Real World Applications will step you through several examples (and features integration with Django, Flask, Jupyter Notebook, Docker, and Azure), so you can hit the ground running with Visual Studio Code.
APRIL SPEIGHT is a developer who specializes in Python and conversational design for chat bots and AI Assistants. Her passion for learning and teaching Python led to her first published title, Bite-Size Python: An Introduction to Python Programming. She currently works on content creation and developer community engagement for Spatial Computing and Mixed Reality at Microsoft.
Introduction xix
Part I Welcome to Visual Studio Code 1
Chapter 1 Getting Started 3
Installing Visual Studio Code 4
The Visual Studio Code User Interface 4
Activity Bar 5
Side Bar 6
Editor 7
Panels 11
Status Bar 12
Command Palette 12
Extensions 14
Customizations 15
Settings 16
Color Themes and Icons 18
Keybindings 18
Display Langage 18
Summary 19
Chapter 2 Hello World for Python 21
Installing a Python Interpreter 21
macOS 22
Linux 22
Windows 22
Installing the Python Extension for Visual Studio Code 22
Creating a Python File 23
Selecting an Interpreter 24
Setting a Default Interpreter 26
Settings Editor 26
settings.json File 26
Selecting a Linter 26
Editing a Python File 27
Running a Python File 29
Workflow Recap 30
Summary 31
Chapter 3 Editing Code 33
Quick Fixes 34
Code Completion, Definitions, and Declarations 35
Formatting 38
Edit Formatting Settings in the Settings Editor 39
Edit Formatting Settings in settings.json 40
Linting 41
Enable and Disable Linting 41
Run Linting 42
Linting Settings 43
Refactoring 44
Extract Variable 44
Extract Method 45
Sort Imports 46
Snippets 47
Summary 48
Part II Additional Visual Studio Code Features 51
Chapter 4 Managing Projects and Collaboration 53
Files and Folders 53
Open a Project 54
Navigate Files 56
Search across Files 57
Close a File or Folder 60
Environments 60
Virtual Environments 61
Conda Environments 61
Source Control 63
Initialize a Repository 65
Commit Changes 66
Branches 69
Remotes 70
Gutter Indicators 71
View Diffs 71
Push and Merge Commits 73
Pull Requests 74
Live Share 74
Install Live Share 75
Sign In to Live Share 76
Share a Project 76
Join a Session 78
Editing and Collaboration 80
Follow a Participant 80
Share a Terminal 81
Summary 82
Chapter 5 Debugging 83
Starting a Debug Session 84
Debug Commands 89
Continue 89
Step Over 90
Step Into 90
Step Out 91
Stop 91
Restart 92
Call Stack 92
Triggering a Breakpoint 93
Logpoints 95
Watch 96
The Debug Console 98
Launch Configurations 101
Summary 104
Chapter 6 Unit Testing 105
Enable and Discover Tests 105
Run Tests 109
Debug Tests 113
Summary 115
Chapter 7 Jupyter Notebook 117
Creating and Opening a Jupyter Notebook 118
Code Cell Modes 120
Adding Cells 121
Editing Cells 122
Running a Cell 124
Running a Single Cell 124
Running All Code Cells 124
Running Cells Above and Below a Code Cell 125
Additional Commands 126
Viewing Variables and Data 126
Viewing Plots 128
Debugging a Jupyter Notebook 129
Connecting to a Remote Server 130
Exporting a Notebook 131
Summary 132
Chapter 8 Using Git and GitHub with Visual Studio Code 135
Getting Started 135
GitHub Pull Requests and Issues Extension 136
Publish a Project to GitHub 139
Push Changes to GitHub 141
Manage Pull Requests and Issues 143
Pull Requests 144
Issues 147
Clone Repository 152
Timeline View 154
Summary 156
Chapter 9 Deploy a Django App to Azure App Service with the Azure App Service Extension 157
Getting Started 157
Creating a Django Project 159
Creating an App 161
Creating a Home Page 163
Creating Website Pages 166
Deploying to Azure 168
Summary 175
Chapter 10 Create and Debug a Flask App 177
Getting Started 177
Create a Flask App 178
Create and Render a Template 180
Debug the Flask App 184
Summary 187
Chapter 11 Create and Deploy a Container with Azure Container Registry and Azure App Service 189
Getting Started 189
Create a Container 191
Add Docker Files to the Project 191
Build an Image 193
Build and Run a Container 195
Debug a Container 197
Push an Image to the Registry 197
Create an Azure Container Registry 198
Determine the Image’s Registry Location 199
Deploy the Container Image to Azure 201
Make Changes to the App and Deploy 205
Multicontainer Apps 206
Summary 207
Chapter 12 Deploy an Azure Function Trigger by a Timer 209
Getting Started 210
Create an Azure Function 211
Invoke the Function Locally 213
Add the Code to the Function 214
Deploy the Function to Azure 215
Summary 220
Appendix Getting Started with Azure 221
Index 225
Erscheinungsdatum | 17.08.2021 |
---|---|
Verlagsort | New York |
Sprache | englisch |
Maße | 185 x 231 mm |
Gewicht | 431 g |
Themenwelt | Mathematik / Informatik ► Informatik |
ISBN-10 | 1-119-77336-9 / 1119773369 |
ISBN-13 | 978-1-119-77336-8 / 9781119773368 |
Zustand | Neuware |
Haben Sie eine Frage zum Produkt? |
aus dem Bereich