{"id":9880,"date":"2024-11-01T09:02:23","date_gmt":"2024-11-01T17:02:23","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=9880"},"modified":"2024-11-01T09:02:23","modified_gmt":"2024-11-01T17:02:23","slug":"python-in-visual-studio-code-november-2024-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-november-2024-release\/","title":{"rendered":"Python in Visual Studio Code &#8211; November 2024 Release"},"content":{"rendered":"<p>We&#8217;re excited to announce the November 2024 release of the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">Python<\/a>, <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.vscode-pylance\">Pylance<\/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>Generate docstrings with Pylance<\/li>\n<li>New fold and unfold all docstrings commands<\/li>\n<li>Import suggestions can now include aliases from user files<\/li>\n<li>Experimental AI Code Action for implementing abstract classes<\/li>\n<li>Native REPL variables view<\/li>\n<\/ul>\n<p>If you&#8217;re 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:\/\/code.visualstudio.com\/updates\/\">Jupyter<\/a> and <a href=\"https:\/\/github.com\/microsoft\/pylance-release\/blob\/main\/CHANGELOG.md\">Pylance<\/a> extensions.<\/p>\n<h2>Generate docstrings with Pylance<\/h2>\n<p>You can now more conveniently generate documentation for your Python code with <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.vscode-pylance\">Pylance<\/a>&#8216;s docstrings template generation feature! You can generate a docstring template for classes or methods by typing <code>\"\"\"<\/code> or <code>'''<\/code>, pressing <code>kbstyle(Ctrl+Space)<\/code>, or selecting the lightbulb to invoke the <strong>Generate Docstring<\/strong> Code Action. The generated docstring includes fields for the function&#8217;s description, parameter descriptions, parameter types, return value description, and return type.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/generatedocs.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9884\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/generatedocs.gif\" alt=\"Generating docstring templates for a function with Pylance by invoking Ctrl+Space inside a pair of triple quotes.\" width=\"2244\" height=\"1383\" \/><\/a><\/p>\n<p>This feature is currently behind an experimental setting, but we look forward to making it the default experience soon. You can try it out today by enabling the <code>python.analysis.supportDocstringTemplate<\/code> setting.<\/p>\n<h2>New fold and unfold all docstrings commands<\/h2>\n<p>Docstrings are great for providing context and explanations for your code, but sometimes you might want to fold them to focus on the code itself. You can now more easily do so by folding docstrings with the new <strong>Pylance: Fold All Docstrings<\/strong> command, which can also be bound to a keybinding of your choice. To unfold them, use the <strong>Pylance: Unfold All Docstrings<\/strong> command.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/fold_unfold_docstrings.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9885\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/fold_unfold_docstrings.gif\" alt=\"Folding and unfolding docstrings with Pylance's new commands.\" width=\"2244\" height=\"1383\" \/><\/a><\/p>\n<h2>Import suggestions with aliases from user files<\/h2>\n<p>One of Pylance&#8217;s most powerful features is its ability to provide <a href=\"https:\/\/code.visualstudio.com\/docs\/python\/editing#_enable-auto-imports\">auto-import suggestions<\/a>. By default, Pylance offers the import suggestion from where the symbol is defined, but you might want it to import from a file where the symbol is imported (i.e. aliased). With the new <code>python.analysis.includeAliasesFromUserFiles<\/code> setting, you can now control whether Pylance includes alias symbols from user files in its auto-import suggestions and in the add import Quick Fix.<\/p>\n<blockquote><p>Note: Enabling this setting can negatively impact performance, especially in large codebases, as Pylance may need to index more symbols and monitor more files for changes, which can increase resource usage.<\/p><\/blockquote>\n<h2>Experimental AI Code Action: Implement Abstract Classes<\/h2>\n<p>You can now get the best of both worlds with AI and static analysis with the new experimental Code Action to implement abstract classes! This feature requires both the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.vscode-pylance\">Pylance<\/a> and the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=GitHub.copilot-chat\">GitHub Copilot<\/a> extensions. To try it out, you can select the <strong>Implement all inherited abstract classes with Copilot<\/strong> Code Action when defining a class that inherits from an abstract one.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/implementabc.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9886\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/implementabc.gif\" alt=\"Implementing methods from an inherited abstract class with code action from Pylance and Copilot\" width=\"2244\" height=\"1385\" \/><\/a><\/p>\n<p>You can disable this feature by setting <code>\"python.analysis.aiCodeActions\": {\"implementAbstractClasses\": false}<\/code> in your User settings.<\/p>\n<h2>Native REPL Variables View<\/h2>\n<p>The Native Python REPL now provides up-to-date variables for the built-in Variables view. This lets you dig into the state of the interpreter as you execute code from files or through the REPL input box.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/variable-viewer-repl.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9881\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/variable-viewer-repl.png\" alt=\"Variable viewer with data from the Native Python REPL\" width=\"1908\" height=\"838\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/variable-viewer-repl.png 1908w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/variable-viewer-repl-300x132.png 300w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/variable-viewer-repl-1024x450.png 1024w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/variable-viewer-repl-768x337.png 768w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/11\/variable-viewer-repl-1536x675.png 1536w\" sizes=\"(max-width: 1908px) 100vw, 1908px\" \/><\/a><\/p>\n<h2>Upcoming deprecation of Python 3.8 support<\/h2>\n<p>Python 3.8 reached <a href=\"https:\/\/peps.python.org\/pep-0569\/\">end-of-life (EOL) on 2024-10-07<\/a>. As such, official support for Python 3.8 in the Python extension will stop in three months, in the February 2025 release of the Python extension. There are no plans to actively remove support for Python 3.8, and so we expect the extension will continue to work unofficially with Python 3.8 for the foreseeable future.<\/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>There&#8217;s a new <a href=\"https:\/\/code.visualstudio.com\/docs\/python\/run\">documentation page<\/a> on the various ways to run Python code in VS Code.<\/li>\n<li>Pixi functionality has been restored only when Pixi is available (<a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/24310\">vscode-python#24310<\/a>).<\/li>\n<li>You can now change the type checking mode to strict or standard from the Language Status menu (<a href=\"https:\/\/github.com\/microsoft\/pylance-release\/issues\/6080\">pylance-release#6080<\/a>)<\/li>\n<\/ul>\n<p>We would also like to extend special thanks to this month&#8217;s contributors:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/mnoah1\">@mnoah1<\/a> Add customizable interpreter discovery timeout in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/24227\">vscode-python#24227<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/brokoli777\">@brokoli777<\/a> Refactor code to remove unused JSDoc types in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/24300\">vscode-python#24300<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/T-256\">@T-256<\/a> Make <code>python_server.py<\/code> compatible to Python 3.7 in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/24252\">vscode-python#24252<\/a>\n<blockquote><p>Note: This doesn&#8217;t guarantee full compatibility nor support for Python 3.7 in other parts of the Python extension. The minimum Python version we support is still Python 3.8 until February 2025, when the minimum officially supported version will be Python 3.9.<\/p><\/blockquote>\n<\/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 November 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include docstring template generation with Pylance, Fold\/Unfold All Docstrings commands, a variable view with the Native REPL and 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-9880","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python"],"acf":[],"blog_post_summary":"<p>The November 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include docstring template generation with Pylance, Fold\/Unfold All Docstrings commands, a variable view with the Native REPL and more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9880","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=9880"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9880\/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=9880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=9880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=9880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}