From 85f57c856160d23e2a4c54f8e017f07183390368 Mon Sep 17 00:00:00 2001 From: Courtney Webster Date: Thu, 19 Jan 2023 16:59:48 -0600 Subject: [PATCH 1/6] updates from doc read --- docs/python/python-tutorial.md | 65 ++++++++++++++++------------------ 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/docs/python/python-tutorial.md b/docs/python/python-tutorial.md index 5709a77cd2..1fe98c554e 100644 --- a/docs/python/python-tutorial.md +++ b/docs/python/python-tutorial.md @@ -4,15 +4,15 @@ Area: python TOCTitle: Tutorial ContentId: 77828f36-ae45-4887-b25c-34545edd52d3 PageTitle: Get Started Tutorial for Python in Visual Studio Code -DateApproved: 8/15/2022 +DateApproved: 1/19/2023 MetaDescription: A Python hello world tutorial using the Python extension in Visual Studio Code (a great Python IDE like PyCharm, if not the best Python IDE) MetaSocialImage: images/tutorial/social.png --- # Getting Started with Python in VS Code -In this tutorial, you use Python 3 to create the simplest Python "Hello World" application in Visual Studio Code. By using the Python extension, you make VS Code into a great lightweight Python IDE (which you may find a productive alternative to PyCharm). +In this tutorial, you will use Python 3 to create the simplest Python "Hello World" application in Visual Studio Code. By using the Python extension, you make VS Code into a great lightweight Python IDE (which you may find a productive alternative to PyCharm). -This tutorial introduces you to VS Code as a Python environment, primarily how to edit, run, and debug code through the following tasks: +This tutorial introduces you to VS Code as a Python environment - primarily how to edit, run, and debug code through the following tasks: - Write, run, and debug a Python "Hello World" Application - Learn how to install packages by creating Python virtual environments @@ -20,7 +20,7 @@ This tutorial introduces you to VS Code as a Python environment, primarily how t This tutorial is not intended to teach you Python itself. Once you are familiar with the basics of VS Code, you can then follow any of the [programming tutorials on python.org](https://wiki.python.org/moin/BeginnersGuide/Programmers) within the context of VS Code for an introduction to the language. -If you have any problems, you can search for answers or ask a question on the [Python extension Discussions Q&A](https://github.com/microsoft/vscode-python/discussions/categories/q-a). +If you have any problems, feel free to file an issue for this tutorial in the [VS Code documentation repository](https://github.com/microsoft/vscode-docs/issues). ## Prerequisites @@ -45,7 +45,7 @@ Along with the Python extension, you need to install a Python interpreter. Which Install [Python from python.org](https://www.python.org/downloads/). You can typically use the **Download Python** button that appears first on the page to download the latest version. ->**Note**: If you don't have admin access, an additional option for installing Python on Windows is to use the Microsoft Store. The Microsoft Store provides installs of [Python 3.7](https://www.microsoft.com/p/python-37/9nj46sx7x90p), [Python 3.8](https://www.microsoft.com/p/python-38/9mssztt1n39l), [Python 3.9](https://www.microsoft.com/p/python-39/9p7qfqmjrfp7), and [Python 3.10](https://www.microsoft.com/p/python-310/9pjpw5ldxlz5). +>**Note**: If you don't have admin access, an additional option for installing Python on Windows is to use the Microsoft Store. The Microsoft Store provides installs of [Python 3.7](https://www.microsoft.com/p/python-37/9nj46sx7x90p), [Python 3.8](https://www.microsoft.com/p/python-38/9mssztt1n39l), [Python 3.9](https://www.microsoft.com/p/python-39/9p7qfqmjrfp7), [Python 3.10](https://www.microsoft.com/p/python-310/9pjpw5ldxlz5), and [Python 3.11](https://apps.microsoft.com/store/detail/python-311/9NRWMJP3717K?hl=en-us&gl=us). For additional information about using Python on Windows, see [Using Python on Windows at Python.org](https://docs.python.org/3.9/using/windows.html) @@ -63,7 +63,7 @@ The built-in Python 3 installation on Linux works well, but to install other Pyt - **Data Science**: If your primary purpose for using Python is Data Science, then you might consider a download from [Anaconda](https://www.anaconda.com/download/). Anaconda provides not just a Python interpreter, but many useful libraries and tools for data science. -- **Windows Subsystem for Linux**: If you are working on Windows and want a Linux environment for working with Python, the [Windows Subsystem for Linux](https://learn.microsoft.com/windows/wsl/about) (WSL) is an option for you. If you choose this option, you'll also want to install the [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl). For more information about using WSL with VS Code, see [VS Code Remote Development](/docs/remote/remote-overview.md) or try the [Working in WSL tutorial](/docs/remote/wsl-tutorial.md), which will walk you through setting up WSL, installing Python, and creating a Hello World application running in WSL. +- **Windows Subsystem for Linux**: If you are working on Windows and want a Linux environment for working with Python, the [Windows Subsystem for Linux](https://docs.microsoft.com/windows/wsl/about) (WSL) is an option for you. If you choose this option, you'll also want to install the [Remote - WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl). For more information about using WSL with VS Code, see [VS Code Remote Development](/docs/remote/remote-overview.md) or try the [Working in WSL tutorial](/docs/remote/wsl-tutorial.md), which will walk you through setting up WSL, installing Python, and creating a Hello World application running in WSL. ## Verify the Python installation @@ -77,7 +77,7 @@ To verify that you've installed Python successfully on your machine, run one of - Windows: open a command prompt and run the following command: - ```bat + ```ps py -3 --version ``` @@ -85,7 +85,9 @@ If the installation was successful, the output window should show the version of > **Note** You can use the `py -0` command in the VS Code integrated terminal to view the versions of python installed on your machine. The default interpreter is identified by an asterisk (*). -## Start VS Code in a project (workspace) folder +## Start VS Code in a workspace folder + +By starting VS Code in a folder, that folder becomes your "workspace". VS Code stores settings that are specific to that workspace in `.vscode/settings.json`, which are separate from user settings that are stored globally. Using a command prompt or terminal, create an empty folder called "hello", navigate into it, and open VS Code (`code`) in that folder (`.`) by entering the following commands: @@ -97,13 +99,11 @@ code . >**Note**: If you're using an Anaconda distribution, be sure to use an Anaconda command prompt. -By starting VS Code in a folder, that folder becomes your "workspace". VS Code stores settings that are specific to that workspace in `.vscode/settings.json`, which are separate from user settings that are stored globally. - Alternately, you can run VS Code through the operating system UI, then use **File > Open Folder** to open the project folder. ## Select a Python interpreter -Python is an interpreted language, and in order to run Python code and get Python IntelliSense, you must tell VS Code which interpreter to use. +Python is an interpreted language. Thus, in order to run Python code and get Python IntelliSense, you must tell VS Code which interpreter to use. From within VS Code, select a Python 3 interpreter by opening the **Command Palette** (`kb(workbench.action.showCommands)`), start typing the **Python: Select Interpreter** command to search, then select the command. You can also use the **Select Python Environment** option on the Status Bar if available (it may already show a selected interpreter, too): @@ -227,7 +227,7 @@ For full details, see [Debugging configurations](/docs/python/debugging.md), whi ## Install and use packages -Let's now run an example that's a little more interesting. In Python, packages are how you obtain any number of useful code libraries, typically from [PyPI](https://pypi.org/). For this example, you use the `matplotlib` and `numpy` packages to create a graphical plot as is commonly done with data science. (Note that `matplotlib` cannot show graphs when running in the [Windows Subsystem for Linux](https://learn.microsoft.com/windows/wsl/about) as it lacks the necessary UI support.) +Let's now run an example that's a little more interesting. In Python, packages are how you obtain any number of useful code libraries, typically from [PyPI](https://pypi.org/). For this example, you use the `matplotlib` and `numpy` packages to create a graphical plot as is commonly done with data science. (Note that `matplotlib` cannot show graphs when running in the [Windows Subsystem for Linux](https://docs.microsoft.com/windows/wsl/about) as it lacks the necessary UI support.) Return to the **Explorer** view (the top-most icon on the left side, which shows files), create a new file called `standardplot.py`, and paste in the following source code: @@ -252,36 +252,33 @@ A best practice among Python developers is to avoid installing packages into a g > **Note**: For additional information about virtual environments, see [Environments](/docs/python/environments.md#creating-environments). -1. Create and activate the virtual environment +1. Create a Virtual Environment using the Create Environment Command - **Virtual environment creation for Windows** + From within VS Code, you can create non-global environments, using Venv or Anaconda, by opening the Command Palette (Ctrl+Shift+P), start typing the `Python: Create Environment` command to search, and then select the command. You can also trigger the `Python: Create Environment' command through the Getting Started with Python page. - ```bat - py -3 -m venv .venv - .venv\scripts\activate - ``` + The command presents a list of environment types, Venv or Conda. - If the activate command generates the message "Activate.ps1 is not digitally signed. You cannot run this script on the - current system.", then you need to temporarily change the PowerShell execution policy to allow scripts to - run (see [About Execution Policies](https://go.microsoft.com/fwlink/?LinkID=135170) in the PowerShell documentation): + ![Create Environment dropdown](images/environments/create_environment_dropdown.png) - ```powershell - Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process - ``` + If you are creating an environment using **Venv**, the command presents a list of interpreters that can be used for your project. - **Virtual environment creation for macOS/Linux** + ![Virtual environment interpreter selection](images/environments/interpreters-list.png) - ```bash - python3 -m venv .venv - source .venv/bin/activate - ``` - >**Note**: When you create a new virtual environment, you should be prompted by VS Code to set it as the default for your workspace folder. If selected, the environment will automatically be activated when you open a new terminal. + If you are creating an environment using **Conda**, the command presents a list of Python versions that can be used for your project. + + ![Conda environment Python version selection](images/environments/conda_environment_python_versions.png) - ![Virtual environment dialog](images/tutorial/virtual-env-dialog.png) + After selecting the desired interpreter or Python version, a notification will show the progress of the environment creation and the environment folder will appear in your workspace. + ![Create environment status notification](images/environments/create_environment_prompt_status.png) -1. Select your new environment by using the **Python: Select Interpreter** command from the **Command Palette**. + The command will also install necessary packages outlined in a requirements/dependencies file, such as requirements.txt, pyproject.toml or environment.yml, located in the project folder. + + > **Note**: If you want to create an environment manually, or run into error in the environment creation process, visit the [Environments](/docs/python/environments.md#create-a-virtual-environment-in-the-terminal) page. + +1. Ensure your new environment is selected by using the **Python: Select Interpreter** command from the **Command Palette**. ![Select an Interpreter](images/tutorial/interpreter-venv.png) + 1. Install the packages ```bash @@ -324,5 +321,5 @@ There is then much more to explore with Python in Visual Studio Code: - [Debugging](/docs/python/debugging.md) - Learn to debug Python both locally and remotely. - [Testing](/docs/python/testing.md) - Configure test environments and discover, run, and debug tests. - [Settings reference](/docs/python/settings-reference.md) - Explore the full range of Python-related settings in VS Code. -- [Deploy Python to Azure App Service using containers](https://learn.microsoft.com/azure/developer/python/tutorial-deploy-containers-01) -- [Deploy Python to Azure App Service on Linux](https://learn.microsoft.com/azure/developer/python/configure-python-web-app-local-environment) +- [Deploy Python to Azure App Service using containers](https://docs.microsoft.com/azure/python/tutorial-deploy-containers-01) +- [Deploy Python to Azure App Service on Linux](https://docs.microsoft.com/azure/python/tutorial-deploy-app-service-on-linux-01) From aeabc9e0407b2e212256c761b525af7495e4d161 Mon Sep 17 00:00:00 2001 From: Courtney Webster Date: Fri, 24 Feb 2023 16:04:11 -0600 Subject: [PATCH 2/6] Update Images --- docs/python/images/debugging/debug-button-editor.png | 4 ++-- docs/python/images/editing/packageAbbreviations.gif | 4 ++-- docs/python/images/editing/refactorRenameModule.gif | 4 ++-- docs/python/images/editing/sortImports.gif | 4 ++-- docs/python/images/flask-tutorial/new-file-icon.png | 4 ++-- docs/python/images/linting/lint-messages.png | 4 ++-- docs/python/images/shared/debug-panel-initial-view.png | 4 ++-- docs/python/images/tutorial/debug-configurations.png | 4 ++-- docs/python/images/tutorial/debug-icon.png | 4 ++-- .../images/tutorial/debug-python-file-in-terminal-button.png | 4 ++-- docs/python/images/tutorial/debug-settings.png | 4 ++-- docs/python/images/tutorial/debug-step-01.png | 4 ++-- docs/python/images/tutorial/debug-step-02.png | 4 ++-- docs/python/images/tutorial/hello-py-file-created.png | 4 ++-- docs/python/images/tutorial/intellisense01.png | 4 ++-- docs/python/images/tutorial/intellisense02.png | 4 ++-- docs/python/images/tutorial/toolbar-new-file.png | 4 ++-- docs/python/images/tutorial/toolbar-new-folder.png | 4 ++-- 18 files changed, 36 insertions(+), 36 deletions(-) diff --git a/docs/python/images/debugging/debug-button-editor.png b/docs/python/images/debugging/debug-button-editor.png index a3ed13b962..611f3620ff 100644 --- a/docs/python/images/debugging/debug-button-editor.png +++ b/docs/python/images/debugging/debug-button-editor.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69adb6e9ab6ff9a6fdf5e82407654b8ca53f48b1984a998ab3040bccd7d03403 -size 19734 +oid sha256:83aa0a90d890bf7036add8d39945951eb08607f16e2f1a2ccea9f4f1e75f9e01 +size 40585 diff --git a/docs/python/images/editing/packageAbbreviations.gif b/docs/python/images/editing/packageAbbreviations.gif index f48e851d34..6eff07966d 100644 --- a/docs/python/images/editing/packageAbbreviations.gif +++ b/docs/python/images/editing/packageAbbreviations.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:49ef1ae8e2abbd904ddf30f49f23bd79e4b8bd06a7b17be1425aa6022c234c80 -size 1541958 +oid sha256:cf22d6d5fef5f75a1678c75d1c83ee97f743b7a20c40481a2e400e16aaf76142 +size 2000757 diff --git a/docs/python/images/editing/refactorRenameModule.gif b/docs/python/images/editing/refactorRenameModule.gif index c86bbaffd8..57f8af43fd 100644 --- a/docs/python/images/editing/refactorRenameModule.gif +++ b/docs/python/images/editing/refactorRenameModule.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2baf3fb919918ac797b34f0d2159b346b553bdb1df3e54fe69da36ed314614f5 -size 2939402 +oid sha256:737a8f1527f79171ef4028444d3a56037fb8be99d5b8cfe5b644d8fb1e44f2fa +size 1395257 diff --git a/docs/python/images/editing/sortImports.gif b/docs/python/images/editing/sortImports.gif index 7001be4fee..f5d37c1dbe 100644 --- a/docs/python/images/editing/sortImports.gif +++ b/docs/python/images/editing/sortImports.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:13b36eeaa9885756b937750dfe1086f665babc1ec5933cf08fabe1ce302cc131 -size 72448 +oid sha256:dc78ead38cd2b947fd43564d445dec30515a68d496f31b065033e9de72b0a425 +size 334960 diff --git a/docs/python/images/flask-tutorial/new-file-icon.png b/docs/python/images/flask-tutorial/new-file-icon.png index 17555a0219..424cfc514a 100644 --- a/docs/python/images/flask-tutorial/new-file-icon.png +++ b/docs/python/images/flask-tutorial/new-file-icon.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:601a6c91e7f27b01d588722d4b030d0b21d36d5d077b3b10ff2fb30554db4732 -size 5155 +oid sha256:3d77bd3f0271e893e54d9ba8e77900dfee3376f6fe3081cda22f92a175feaa94 +size 12793 diff --git a/docs/python/images/linting/lint-messages.png b/docs/python/images/linting/lint-messages.png index e1f7940c63..616971865e 100644 --- a/docs/python/images/linting/lint-messages.png +++ b/docs/python/images/linting/lint-messages.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fda4fbf120b0c23745daaa9c514a857c93384c6344cb2b3d477cfe8d5b3405eb -size 13979 +oid sha256:c0ee9934d4b802eebf16d5da2245b98610a827f78e77bdb60d8cdcbe3b27781d +size 196723 diff --git a/docs/python/images/shared/debug-panel-initial-view.png b/docs/python/images/shared/debug-panel-initial-view.png index 73bcf13d60..e54d8a784e 100644 --- a/docs/python/images/shared/debug-panel-initial-view.png +++ b/docs/python/images/shared/debug-panel-initial-view.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a174c568e7f9b6c0c4b234f41b6576dd9d24e033bb1275ce96a863514e25e72 -size 5562 +oid sha256:ffb050d833f561e01918eb5c787ef8e430349973ae32e9c937b285e38e4c5181 +size 14161 diff --git a/docs/python/images/tutorial/debug-configurations.png b/docs/python/images/tutorial/debug-configurations.png index 5e747777b0..6869a6baff 100644 --- a/docs/python/images/tutorial/debug-configurations.png +++ b/docs/python/images/tutorial/debug-configurations.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a472da12da5d8780791a5454f1477017e6cf6b63979d0fad644cd2ab5b39f59 -size 23112 +oid sha256:8a0e5244e8edeeb89006cd5fadc9d65f3279d32b8ef215a03ab396a3150e4375 +size 137192 diff --git a/docs/python/images/tutorial/debug-icon.png b/docs/python/images/tutorial/debug-icon.png index 222f83bce1..40d10866f1 100644 --- a/docs/python/images/tutorial/debug-icon.png +++ b/docs/python/images/tutorial/debug-icon.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a04b5481091ce04d0fec7555de65de0cb691d6dee7a6ff83ef5455c73b475b2d -size 322 +oid sha256:71c49a45d01b0db00283a6ff56b2e0984256db27392ce0e4a25c9c2ee21bd2df +size 2083 diff --git a/docs/python/images/tutorial/debug-python-file-in-terminal-button.png b/docs/python/images/tutorial/debug-python-file-in-terminal-button.png index 91e8d3bd6c..be3bff2655 100644 --- a/docs/python/images/tutorial/debug-python-file-in-terminal-button.png +++ b/docs/python/images/tutorial/debug-python-file-in-terminal-button.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:675bd23e4fbfe050eda204b8c7997269297f6156af0529424ee71f70aaa19cde -size 8471 +oid sha256:49044b1010d4c42a9e0c063af4142ada97228a19ac284aa4a71887038c3d27ae +size 37470 diff --git a/docs/python/images/tutorial/debug-settings.png b/docs/python/images/tutorial/debug-settings.png index 0ca3d575fa..d829bea21a 100644 --- a/docs/python/images/tutorial/debug-settings.png +++ b/docs/python/images/tutorial/debug-settings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3c9f09c27f07bb406ffc86644957c8e9ae45eeaac9865add6299896059724342 -size 1562 +oid sha256:18c64231854c19cbb21a10efe277fde4ab0bf5c43e4519b0f014b60ffca7f1d0 +size 9462 diff --git a/docs/python/images/tutorial/debug-step-01.png b/docs/python/images/tutorial/debug-step-01.png index 9d11563dc4..d21dacd947 100644 --- a/docs/python/images/tutorial/debug-step-01.png +++ b/docs/python/images/tutorial/debug-step-01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1595303ee62d796ac0fe2bb5932ffbe56cdbf34dd15fe005edf68b8b41da53ee -size 16165 +oid sha256:062ec00386e9fbe50ad3faf7741f559179694d59e3c9cf1e8e67a72a09369c32 +size 98408 diff --git a/docs/python/images/tutorial/debug-step-02.png b/docs/python/images/tutorial/debug-step-02.png index dbb3fa7dfd..6ce05aa1c4 100644 --- a/docs/python/images/tutorial/debug-step-02.png +++ b/docs/python/images/tutorial/debug-step-02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d460b2e6389d518fcc4768e27f8c353310a222bec458c8f9fb01da4650a498da -size 26182 +oid sha256:7310104766a8895dea861471a72985d51c21b1b5c8f59fb40b7a7dde2096fa26 +size 45244 diff --git a/docs/python/images/tutorial/hello-py-file-created.png b/docs/python/images/tutorial/hello-py-file-created.png index abf6aa02b3..320603e3e2 100644 --- a/docs/python/images/tutorial/hello-py-file-created.png +++ b/docs/python/images/tutorial/hello-py-file-created.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:569d880323128b7d4cbd4e9495e95fe7f9c380f1525d3e21d2afc193c9a2e600 -size 9802 +oid sha256:7def0e14216e0f9c89efd67ac3908492622b97b185f54be315f6d42911f014e3 +size 15725 diff --git a/docs/python/images/tutorial/intellisense01.png b/docs/python/images/tutorial/intellisense01.png index a60409ccc6..0b7a9b7654 100644 --- a/docs/python/images/tutorial/intellisense01.png +++ b/docs/python/images/tutorial/intellisense01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:374105ba71166ed83fde2f49263423f3cbdaf614c27b9d2c141b211b3c4a681c -size 20553 +oid sha256:c691e14d8606db3705eb0dcce11a5e496a41598026a7b979f25024a19d8e7c46 +size 53118 diff --git a/docs/python/images/tutorial/intellisense02.png b/docs/python/images/tutorial/intellisense02.png index ba70314ee5..3dc1ce88b6 100644 --- a/docs/python/images/tutorial/intellisense02.png +++ b/docs/python/images/tutorial/intellisense02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e20d6b46d0203e10d58e7305ccd6c1868d7fc6407f937f4c48182b46aeaeeb17 -size 16974 +oid sha256:2d8b56b5a18d5ca104ea0e5c8fb177009f2137f5cba031fac46960a6be893b53 +size 65632 diff --git a/docs/python/images/tutorial/toolbar-new-file.png b/docs/python/images/tutorial/toolbar-new-file.png index 7d7a66ddfa..535fd89a97 100644 --- a/docs/python/images/tutorial/toolbar-new-file.png +++ b/docs/python/images/tutorial/toolbar-new-file.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f5e11bd4b5edde9e3966b0b6c2d862a3ece36020fce1964ddbdea9501271866 -size 4341 +oid sha256:636a658c5c4d3ee0e5e0c6c3902d97acf00a391c6b48110e472230fe4481cc13 +size 11813 diff --git a/docs/python/images/tutorial/toolbar-new-folder.png b/docs/python/images/tutorial/toolbar-new-folder.png index 03d243685a..6faa47bf9d 100644 --- a/docs/python/images/tutorial/toolbar-new-folder.png +++ b/docs/python/images/tutorial/toolbar-new-folder.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:172e3a52b625b9bb5e48eb432dd5abb3aa111e58b56da526314dc0a6eebd7894 -size 4375 +oid sha256:5b4678fd92dedfb9ad83aec82cd2e56e19e0aee941045da3386ae0588665c4f7 +size 11788 From d1fce600de8100075579fab588de87cee9fb0713 Mon Sep 17 00:00:00 2001 From: Courtney Webster <60238438+cwebster-99@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:16:13 -0600 Subject: [PATCH 3/6] Apply suggestions from code review --- docs/python/python-tutorial.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/python/python-tutorial.md b/docs/python/python-tutorial.md index c51ca343a2..37f7e4f780 100644 --- a/docs/python/python-tutorial.md +++ b/docs/python/python-tutorial.md @@ -4,9 +4,7 @@ Area: python TOCTitle: Tutorial ContentId: 77828f36-ae45-4887-b25c-34545edd52d3 PageTitle: Get Started Tutorial for Python in Visual Studio Code - DateApproved: 1/20/2023 - MetaDescription: A Python hello world tutorial using the Python extension in Visual Studio Code (a great Python IDE like PyCharm, if not the best Python IDE) MetaSocialImage: images/tutorial/social.png --- From 49eef0502a01c230714fda424053492ffa3501aa Mon Sep 17 00:00:00 2001 From: Courtney Webster <60238438+cwebster-99@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:19:01 -0600 Subject: [PATCH 4/6] Apply suggestions from code review --- docs/python/python-tutorial.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/python/python-tutorial.md b/docs/python/python-tutorial.md index 37f7e4f780..f443a7faf8 100644 --- a/docs/python/python-tutorial.md +++ b/docs/python/python-tutorial.md @@ -20,7 +20,7 @@ This tutorial introduces you to VS Code as a Python environment - primarily how This tutorial is not intended to teach you Python itself. Once you are familiar with the basics of VS Code, you can then follow any of the [programming tutorials on python.org](https://wiki.python.org/moin/BeginnersGuide/Programmers) within the context of VS Code for an introduction to the language. -If you have any problems, feel free to file an issue for this tutorial in the [VS Code documentation repository](https://github.com/microsoft/vscode-docs/issues). +If you have any problems, you can search for answers or ask a question on the [Python extension Discussions Q&A](https://github.com/microsoft/vscode-python/discussions/categories/q-a). ## Prerequisites @@ -45,10 +45,8 @@ Along with the Python extension, you need to install a Python interpreter. Which Install [Python from python.org](https://www.python.org/downloads/). You can typically use the **Download Python** button that appears first on the page to download the latest version. - >**Note**: If you don't have admin access, an additional option for installing Python on Windows is to use the Microsoft Store. The Microsoft Store provides installs of [supported Python versions](https://apps.microsoft.com/store/search?publisher=Python%20Software%20Foundation). - For additional information about using Python on Windows, see [Using Python on Windows at Python.org](https://docs.python.org/3.9/using/windows.html) ### macOS @@ -65,7 +63,7 @@ The built-in Python 3 installation on Linux works well, but to install other Pyt - **Data Science**: If your primary purpose for using Python is Data Science, then you might consider a download from [Anaconda](https://www.anaconda.com/download/). Anaconda provides not just a Python interpreter, but many useful libraries and tools for data science. -- **Windows Subsystem for Linux**: If you are working on Windows and want a Linux environment for working with Python, the [Windows Subsystem for Linux](https://docs.microsoft.com/windows/wsl/about) (WSL) is an option for you. If you choose this option, you'll also want to install the [Remote - WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl). For more information about using WSL with VS Code, see [VS Code Remote Development](/docs/remote/remote-overview.md) or try the [Working in WSL tutorial](/docs/remote/wsl-tutorial.md), which will walk you through setting up WSL, installing Python, and creating a Hello World application running in WSL. +- **Windows Subsystem for Linux**: If you are working on Windows and want a Linux environment for working with Python, the [Windows Subsystem for Linux](https://learn.microsoft.com/windows/wsl/about) (WSL) is an option for you. If you choose this option, you'll also want to install the [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl). For more information about using WSL with VS Code, see [VS Code Remote Development](/docs/remote/remote-overview.md) or try the [Working in WSL tutorial](/docs/remote/wsl-tutorial.md), which will walk you through setting up WSL, installing Python, and creating a Hello World application running in WSL. ## Verify the Python installation @@ -79,7 +77,7 @@ To verify that you've installed Python successfully on your machine, run one of - Windows: open a command prompt and run the following command: - ```ps + ```bat py -3 --version ``` @@ -229,7 +227,7 @@ For full details, see [Debugging configurations](/docs/python/debugging.md), whi ## Install and use packages -Let's now run an example that's a little more interesting. In Python, packages are how you obtain any number of useful code libraries, typically from [PyPI](https://pypi.org/). For this example, you use the `matplotlib` and `numpy` packages to create a graphical plot as is commonly done with data science. (Note that `matplotlib` cannot show graphs when running in the [Windows Subsystem for Linux](https://docs.microsoft.com/windows/wsl/about) as it lacks the necessary UI support.) +Let's now run an example that's a little more interesting. In Python, packages are how you obtain any number of useful code libraries, typically from [PyPI](https://pypi.org/). For this example, you use the `matplotlib` and `numpy` packages to create a graphical plot as is commonly done with data science. (Note that `matplotlib` cannot show graphs when running in the [Windows Subsystem for Linux](https://learn.microsoft.com/windows/wsl/about) as it lacks the necessary UI support.) Return to the **Explorer** view (the top-most icon on the left side, which shows files), create a new file called `standardplot.py`, and paste in the following source code: @@ -279,7 +277,6 @@ v 1. Ensure your new environment is selected by using the **Python: Select Interpreter** command from the **Command Palette**. ![Select an Interpreter](images/tutorial/interpreter-venv.png) - 1. Install the packages ```bash @@ -322,6 +319,5 @@ There is then much more to explore with Python in Visual Studio Code: - [Debugging](/docs/python/debugging.md) - Learn to debug Python both locally and remotely. - [Testing](/docs/python/testing.md) - Configure test environments and discover, run, and debug tests. - [Settings reference](/docs/python/settings-reference.md) - Explore the full range of Python-related settings in VS Code. - - [Deploy Python to Azure App Service](https://learn.microsoft.com/azure/developer/python/tutorial-containerize-deploy-python-web-app-azure-01) - [Deploy Python to Container Apps](https://learn.microsoft.com/azure/developer/python/tutorial-deploy-python-web-app-azure-container-apps-01) From c84d792de77b7db14707cbd3ce6ec4620989e905 Mon Sep 17 00:00:00 2001 From: Courtney Webster <60238438+cwebster-99@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:19:33 -0600 Subject: [PATCH 5/6] Update docs/python/python-tutorial.md --- docs/python/python-tutorial.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/python/python-tutorial.md b/docs/python/python-tutorial.md index f443a7faf8..c5cf13556f 100644 --- a/docs/python/python-tutorial.md +++ b/docs/python/python-tutorial.md @@ -99,6 +99,7 @@ code . >**Note**: If you're using an Anaconda distribution, be sure to use an Anaconda command prompt. + Alternately, you can run VS Code through the operating system UI, then use **File > Open Folder** to open the project folder. ## Select a Python interpreter From af1c31e94fe25be116a7b24a4ed6cb13c5eb7bb0 Mon Sep 17 00:00:00 2001 From: Courtney Webster Date: Mon, 27 Feb 2023 11:15:24 -0600 Subject: [PATCH 6/6] clean up of activity bar --- docs/python/images/editing/packageAbbreviations.gif | 4 ++-- docs/python/images/editing/refactorRenameModule.gif | 4 ++-- docs/python/images/editing/sortImports.gif | 4 ++-- docs/python/images/flask-tutorial/new-file-icon.png | 6 ++---- docs/python/images/shared/debug-panel-initial-view.png | 5 ++--- docs/python/images/tutorial/debug-step-01.png | 4 ++-- docs/python/images/tutorial/debug-step-02.png | 4 ++-- docs/python/images/tutorial/intellisense01.png | 4 ++-- docs/python/images/tutorial/intellisense02.png | 4 ++-- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/docs/python/images/editing/packageAbbreviations.gif b/docs/python/images/editing/packageAbbreviations.gif index 6eff07966d..6f6b189a11 100644 --- a/docs/python/images/editing/packageAbbreviations.gif +++ b/docs/python/images/editing/packageAbbreviations.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf22d6d5fef5f75a1678c75d1c83ee97f743b7a20c40481a2e400e16aaf76142 -size 2000757 +oid sha256:6cb9e196ddf617d55d0919d2323a7b47cc8199a2b8dc0f3be43c9ec808986978 +size 1997086 diff --git a/docs/python/images/editing/refactorRenameModule.gif b/docs/python/images/editing/refactorRenameModule.gif index 57f8af43fd..4c704c427d 100644 --- a/docs/python/images/editing/refactorRenameModule.gif +++ b/docs/python/images/editing/refactorRenameModule.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:737a8f1527f79171ef4028444d3a56037fb8be99d5b8cfe5b644d8fb1e44f2fa -size 1395257 +oid sha256:99f18baaccf048f37b3b8b5ecf5278f45da4d3d01d1cd29ad5e81a29de6caf2d +size 6272704 diff --git a/docs/python/images/editing/sortImports.gif b/docs/python/images/editing/sortImports.gif index f5d37c1dbe..a49bce9ac7 100644 --- a/docs/python/images/editing/sortImports.gif +++ b/docs/python/images/editing/sortImports.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc78ead38cd2b947fd43564d445dec30515a68d496f31b065033e9de72b0a425 -size 334960 +oid sha256:c341a7b427d992e6dca4e7b0920fee826fdd19acdf33ed1bd7dd6d88aa86215f +size 424865 diff --git a/docs/python/images/flask-tutorial/new-file-icon.png b/docs/python/images/flask-tutorial/new-file-icon.png index af0f2c4c91..3e825673a2 100644 --- a/docs/python/images/flask-tutorial/new-file-icon.png +++ b/docs/python/images/flask-tutorial/new-file-icon.png @@ -1,5 +1,3 @@ version https://git-lfs.github.com/spec/v1 - -oid sha256:ab45cdb228ce64a8dcc702b5275499877e71365d59078d711a9cdd005cc90db1 -size 27223 - +oid sha256:5886375809d10d55db4339c2a7a54002ee5eb95cccd98ae05decfed4bb27d640 +size 20137 diff --git a/docs/python/images/shared/debug-panel-initial-view.png b/docs/python/images/shared/debug-panel-initial-view.png index 2837d4a586..ac2ad8ea09 100644 --- a/docs/python/images/shared/debug-panel-initial-view.png +++ b/docs/python/images/shared/debug-panel-initial-view.png @@ -1,4 +1,3 @@ version https://git-lfs.github.com/spec/v1 - -oid sha256:68365abdd0fca2a03616698353b5299f95f20f3cf0c673b738d2ac60f5da304e -size 64531 +oid sha256:5ae8d7f0ee58eb33f036116f24bddd5c9db783d38597990149c3d285c96cd229 +size 52400 diff --git a/docs/python/images/tutorial/debug-step-01.png b/docs/python/images/tutorial/debug-step-01.png index d21dacd947..87c63d4637 100644 --- a/docs/python/images/tutorial/debug-step-01.png +++ b/docs/python/images/tutorial/debug-step-01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:062ec00386e9fbe50ad3faf7741f559179694d59e3c9cf1e8e67a72a09369c32 -size 98408 +oid sha256:a13aa56321a5edf18c3dd75e83dba680608d291a793087bcb22d2c06f68028f1 +size 165325 diff --git a/docs/python/images/tutorial/debug-step-02.png b/docs/python/images/tutorial/debug-step-02.png index 6ce05aa1c4..9eb99cf378 100644 --- a/docs/python/images/tutorial/debug-step-02.png +++ b/docs/python/images/tutorial/debug-step-02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7310104766a8895dea861471a72985d51c21b1b5c8f59fb40b7a7dde2096fa26 -size 45244 +oid sha256:31e18ce33b4273af5244e05585256e36a1b6531f38399815d97c4ce3bd6a4678 +size 134084 diff --git a/docs/python/images/tutorial/intellisense01.png b/docs/python/images/tutorial/intellisense01.png index 0b7a9b7654..4772592aa3 100644 --- a/docs/python/images/tutorial/intellisense01.png +++ b/docs/python/images/tutorial/intellisense01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c691e14d8606db3705eb0dcce11a5e496a41598026a7b979f25024a19d8e7c46 -size 53118 +oid sha256:c731d4cc60d2efa7936e020218322e81651539d36f87cd9b2ae6b90d0897f33e +size 86453 diff --git a/docs/python/images/tutorial/intellisense02.png b/docs/python/images/tutorial/intellisense02.png index 3dc1ce88b6..112aedb5e5 100644 --- a/docs/python/images/tutorial/intellisense02.png +++ b/docs/python/images/tutorial/intellisense02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d8b56b5a18d5ca104ea0e5c8fb177009f2137f5cba031fac46960a6be893b53 -size 65632 +oid sha256:c9431f34392b95d216b5d12ac3bb01325c1d3eb2206a6798d9ed1879e5525e14 +size 97333