{"id":9229,"date":"2022-12-08T08:22:12","date_gmt":"2022-12-08T16:22:12","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=9229"},"modified":"2022-12-08T14:03:41","modified_gmt":"2022-12-08T22:03:41","slug":"python-in-visual-studio-code-december-2022-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-december-2022-release\/","title":{"rendered":"Python in Visual Studio Code &#8211; December 2022 Release"},"content":{"rendered":"<p>We\u2019re excited to announce that the December 2022 release of the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">Python<\/a> and <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-toolsai.jupyter\">Jupyter<\/a> extensions for Visual Studio Code are now available!<\/p>\n<p>This release includes the following announcements:<\/p>\n<ul>\n<li>Auto indentation with Pylance<\/li>\n<li>Preview: Python in the browser<\/li>\n<li>Community Highlight: Ruff<\/li>\n<\/ul>\n<p>If you\u2019re interested, you can check the full list of improvements in our changelogs for the <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/releases\">Python<\/a>, <a href=\"https:\/\/github.com\/microsoft\/vscode-jupyter\/blob\/main\/CHANGELOG.md\">Jupyter<\/a> and <a href=\"https:\/\/github.com\/microsoft\/pylance-release\/blob\/main\/CHANGELOG.md\">Pylance<\/a> extensions.<\/p>\n<h2>Auto indentation with Pylance<\/h2>\n<p>The Pylance extension for VS Code is working to improve our auto indent feature through its deeper understanding of Python! This feature allows you to focus more on the logic of your code and less on formatting. Try it out in <a href=\"https:\/\/code.visualstudio.com\/insiders\/\">VS Code Insiders<\/a> using the Pre-Release version of the Python extension! You can tell it has been enabled by verifying that the following setting has been automatically added in the User <code>settings.json<\/code> file (View &gt; Command Palette and run &#8220;Preferences: Open User Settings (JSON)&#8221;):<\/p>\n<pre><code>\r\n \"[python]\": {\r\n\r\n        \"editor.formatOnType\": true,\r\n\r\n    },\r\n<\/code><\/pre>\n<p>We&#8217;re turning this setting on by default over the next couple of months. If you have any issues or feedback, please let us know in the <a href=\"https:\/\/github.com\/microsoft\/pylance-release\">Pylance GitHub repository<\/a>.<\/p>\n<h2>Preview: Python in the browser<\/h2>\n<p>You can now try our experiment running and debugging Python code in the browser within <a href=\"vscode.dev\">vscode.dev<\/a>!<\/p>\n<p>There&#8217;s a new VS Code extension that allows you to try running Python code in the Web using <a href=\"https:\/\/webassembly.org\/\">WebAssembly<\/a> as an execution engine. Please note that this extension is being used for experimental and research purposes to gain an understanding of running Python code in the Web using WebAssembly and should <strong>not<\/strong> be used for production Python development as there are significant limitations.<\/p>\n<p>Feel free to play around with this preview by following the steps below:<\/p>\n<ul>\n<li>Open a Chrome based browser (e.g. Microsoft Edge or Google Chrome)<\/li>\n<li>Navigate to a GitHub repository using the URL template <code>https:\/\/insiders.vscode.dev\/github\/{username}\/{repo}?vscode-coi=<\/code>; replace <code>{username}<\/code> and <code>{repo}<\/code> as appropriate for your needs. If you need one, you can use https:\/\/insiders.vscode.dev\/github\/dbaeumer\/python-sample?vscode-coi= . Ensure that the query parameter <code>?vscode-coi=<\/code> is appended to the URL<\/li>\n<li>Install the latest pre-release version of the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.vscode-python-web-wasm\"><code>Experimental - Python for the Web<\/code> extension<\/a><\/li>\n<li>Open a Python file<\/li>\n<li>Execute the file by using the Editor&#8217;s Run menu<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2022\/12\/run_python_wasm.png\" alt=\"Picture shows options to Run or Debug Python files in WASM\" width=\"363\" height=\"139\" \/><\/p>\n<ul>\n<li>Debug the Python file using the same Run menu<\/li>\n<li>Create a launch config (e.g.)\n<pre><code>{\r\n    \"type\": \"python-web-wasm\",\r\n    \"name\": \"Debug Active Python File\",\r\n    \"request\": \"launch\",\r\n    \"program\": \"${file}\",\r\n    \"stopOnEntry\": true,\r\n    \"console\": \"integratedTerminal\"\r\n}<\/code><\/pre>\n<\/li>\n<li>Start debugging using the launch configuration to play with debugging features<\/li>\n<\/ul>\n<h2>Community Highlight: Ruff<\/h2>\n<p><a href=\"https:\/\/github.com\/charliermarsh\">@charliermarsh<\/a>, creator of the <a href=\"https:\/\/pypi.org\/project\/ruff\/\">ruff linter<\/a>, created an accompanying <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=charliermarsh.ruff\">Ruff extension<\/a> using the <a href=\"https:\/\/github.com\/microsoft\/vscode-python-tools-extension-template\">Python tools extension template<\/a>. This VS Code extension provides support for the Ruff linter and currently ships with <code>ruff==0.0.138<\/code>. Once installed in Visual Studio Code, Ruff will be run on your code when you open or edit a Python file. Support includes linting that replaces uses of flake8, <code>isort<\/code>-compatible import sorting with <code>Organize Imports<\/code>, &#8220;Quick Fix&#8221; actions for auto-fixable violations equivalent to Ruff&#8217;s <code>--fix<\/code> support, and a <code>Fix all<\/code> command for automatically fixing auto-fixable violations.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/user-images.githubusercontent.com\/60238438\/206568463-80c793b4-5a95-426f-a056-44588ff545b9.gif\" alt=\"Organizing imports using the Ruff extension\" width=\"2486\" height=\"1529\" \/><\/p>\n<p>Moreover, you can configure Ruff to auto-fix violations on-save by enabling the <code>source.fixAll<\/code> action in <code>settings.json<\/code>:<\/p>\n<pre><code>{\r\n    \"editor.codeActionsOnSave\": {\r\n        \"source.fixAll\": true\r\n    }\r\n}<\/code><\/pre>\n<p>Just like Charlie, you can use the extension template to create a VS Code extension for your own favorite linter or formatter and do it by changing mainly Python code! For more information about the template, please reference our <a href=\"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-august-2022-release\/#python-tools-extension-template\">August 2022 Release<\/a> and give the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=charliermarsh.ruff\">Ruff extension<\/a> a try!<\/p>\n<h2>Other Changes and Enhancements<\/h2>\n<p>We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python and Jupyter Notebooks in Visual Studio Code. Some notable changes include:<\/p>\n<ul>\n<li>Jupyter support for pasting of images by default <a href=\"https:\/\/github.com\/microsoft\/vscode-jupyter\/issues\/11987\">(vscode-jupyter#11987)<\/a><\/li>\n<li>Support disabling &#8220;justMyCode&#8221; for Jupyter debugging <a href=\"https:\/\/github.com\/microsoft\/vscode-jupyter\/issues\/8146\">(vscode-jupyter#8146)<\/a><\/li>\n<\/ul>\n<p>Try out these new improvements by downloading the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">Python extension<\/a> and the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-toolsai.jupyter\">Jupyter extension<\/a> from the Marketplace, or install them directly from the extensions view in Visual Studio Code (Ctrl + Shift + X or \u2318 + \u21e7 + X). You can learn more about <a href=\"https:\/\/code.visualstudio.com\/docs\/python\/python-tutorial\">Python support in Visual Studio Code<\/a> in the documentation. If you run into any problems or have suggestions, <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/new\/choose\">please file an issue<\/a> on the <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\">Python VS Code GitHub page<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The December 2022 release of the Python and Jupyter extensions for Visual Studio Code are now available. This release includes auto indentation with Pylance, a preview of Python in the browser and a community highlight. Keep on reading to learn more!<\/p>\n","protected":false},"author":99209,"featured_media":10119,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[17],"class_list":["post-9229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python"],"acf":[],"blog_post_summary":"<p>The December 2022 release of the Python and Jupyter extensions for Visual Studio Code are now available. This release includes auto indentation with Pylance, a preview of Python in the browser and a community highlight. Keep on reading to learn more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/users\/99209"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/comments?post=9229"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9229\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/10119"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=9229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=9229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=9229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}