{"id":9615,"date":"2024-02-28T11:41:52","date_gmt":"2024-02-28T19:41:52","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=9615"},"modified":"2024-02-28T12:38:15","modified_gmt":"2024-02-28T20:38:15","slug":"python-in-visual-studio-code-march-2024-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-march-2024-release\/","title":{"rendered":"Python in Visual Studio Code &#8211; March 2024 Release"},"content":{"rendered":"<p>We\u2019re excited to announce the March 2024 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!<\/p>\n<p>This release includes the following announcements:<\/p>\n<ul>\n<li>New <strong>Add Imports<\/strong> Code Action heuristics setting<\/li>\n<li>Automatically start your browser when debugging Django or Flask apps<\/li>\n<li>Shell integration for the Python REPL<\/li>\n<li>Language support for locally running Jupyter servers<\/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>New <strong>Add Imports<\/strong> Code Action heuristics setting<\/h2>\n<p>The <strong>Add Import<\/strong> Quick Fix (\ud83d\udca1) , triggered when there are missing imports in your Python project, has been improved in the pre-release version of the Pylance extension! Pylance now uses heuristics to show only the top 3 high-confidence import options, prioritized based on: most recently used imports, symbols from the same module, symbols from the standard library, symbols from user modules, symbols from third-party packages, and finally sorting by module and symbol name. In the case where the 3 high-confidence import options aren&#8217;t what you are looking for, Pylance introduced a new Code Action, <strong>Search for additional import matches<\/strong>, which displays a quick pick menu that allows you to search for import options that prefix-match the missing import symbol.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/add-imprt-v4.gif\"><img decoding=\"async\" class=\"alignnone wp-image-9628 size-full\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/add-imprt-v4.gif\" alt=\"Pylance Quick Fix and Code Actions for missing imports.\" width=\"2500\" height=\"1303\" \/><\/a><\/p>\n<p>Additionally, Pylance introduced the <strong>Change spelling<\/strong> Code Action, which offers import suggestions for missing imports due to typos.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/codespellingv2.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9629\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/codespellingv2.gif\" alt=\"Fix code spelling Code Action with Pylance.\" width=\"2500\" height=\"1303\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>We plan to enable this new behavior by default soon. However in the meantime, you can enable it now by setting <code>python.analysis.addImport.heuristics : \"true\"<\/code> in your settings.<\/p>\n<h2>Automatically start your browser when debugging Django or Flask apps<\/h2>\n<p>Developing and testing your Python web applications is now more convenient with the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.debugpy\">Python Debugger extension<\/a>! You can now get the browser to automatically open when starting the debugger with Django or Flask apps, by setting <code>autoStartBrowser: true<\/code> in your <code>launch.json<\/code> configuration:<\/p>\n<pre><code>{\r\n    \"name\": \"Python Debugger: Flask\",\r\n    \"type\": \"debugpy\",\r\n    \"request\": \"launch\",\r\n    \"module\": \"flask\",\r\n    \"env\": {\r\n        \"FLASK_APP\": \"hello_app.webapp\",\r\n        \"FLASK_DEBUG\": \"1\"\r\n    },\r\n    \"args\": [\r\n        \"run\"\r\n    ],\r\n    \"jinja\": true,\r\n    \"autoStartBrowser\": true\r\n}<\/code><\/pre>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/browser-auto-open.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9618\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/browser-auto-open.gif\" alt=\"Auto start browser for web apps using the Python debugger extension.\" width=\"1920\" height=\"1080\" \/><\/a><\/p>\n<h2>Shell integration for the Python REPL<\/h2>\n<p>We now have shell integration for Python REPL enabled on Mac, Linux and Windows (when using the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode-remote.remote-wsl\">WSL extension<\/a>). When executing commands in the Python REPL, colored circle decorators will indicate whether the commands succeeded or failed. This also enables support for the <strong>Terminal: Run Recent Command<\/strong> command, allowing you to view and utilize the REPL&#8217;s command history. Additionally, this feature allows access to Python\u2019s shell file history for all operating systems via <strong>Terminal: Run Recent Command<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/python-shell-integration.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9619\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/02\/python-shell-integration.gif\" alt=\"Shell integration support for the Python REPL.\" width=\"2491\" height=\"1402\" \/><\/a><\/p>\n<h2>Language support for locally running Jupyter servers<\/h2>\n<p>Previously, when connecting to local Jupyter servers, the Jupyter extension treated these servers as remote, and as a result the Pylance extension was unable to detect the installed packages. In this iteration, we made changes so that the Jupyter extension detects whether the connected Jupyter server is local or remote, and as a result Pylance is now able to provide richer language features based on packages installed within a local Python environment.<\/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>Reduce the risk of losing first command sent to the Python REPL <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/22691\">@vscode-python#22691<\/a>.<\/li>\n<li>Bug fixes for pytest in symlinked workspaces <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/22658\">@vscode-python#22658<\/a>.<\/li>\n<\/ul>\n<p>We would also like to extend special thanks to this month\u2019s contributors:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/aydar-kamaltdinov\">@aydar-kamaltdinov<\/a> Add UnicodeDecodeError catching in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/22873\">@vscode-python#22873<\/a><\/li>\n<\/ul>\n<h2>Call for Community Feedback<\/h2>\n<p>As we are planning and prioritizing future work, we value your feedback! Below are a few issues we would love feedback on:<\/p>\n<ul>\n<li>Design proposal for test coverage in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/22827\">(@vscode-python#22827)<\/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 March 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include new add import Code Actions from Pylance, improvements for developing and testing web apps, shell integration in the Python REPL, and improved language support for local Jupyter servers. Keep 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,6],"tags":[17,1261],"class_list":["post-9615","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-visual-studio-code","tag-python","tag-release"],"acf":[],"blog_post_summary":"<p>The March 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include new add import Code Actions from Pylance, improvements for developing and testing web apps, shell integration in the Python REPL, and improved language support for local Jupyter servers. Keep reading to learn more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9615","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=9615"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9615\/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=9615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=9615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=9615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}