{"id":9662,"date":"2024-04-04T12:50:48","date_gmt":"2024-04-04T20:50:48","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=9662"},"modified":"2024-04-04T12:50:48","modified_gmt":"2024-04-04T20:50:48","slug":"python-in-visual-studio-code-april-2024-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-april-2024-release\/","title":{"rendered":"Python in Visual Studio Code &#8211; April 2024 Release"},"content":{"rendered":"<p>We\u2019re excited to announce the April 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>Improved debug config flow for Flask and Django<\/li>\n<li>Module and import analysis on Jupyter&#8217;s <strong>Run Dependent Cells<\/strong> with Pylance<\/li>\n<li>Hatch environment discovery<\/li>\n<li>Automatic environment selection for pipenv, pyenv, and Poetry projects<\/li>\n<li>Report Issue command improvements<\/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:\/\/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>Improved debug config flow for Flask and Django<\/h2>\n<p>Creating launch configurations for Flask and Django apps just got easier! Improvements have been made to detect possible startup files in your workspace when creating a <code>launch.json<\/code> for your web app. For Django, the Python Debugger extension looks for <code>manage.py<\/code> or <code>app.py<\/code> files in the root or a subdirectory one level lower in your workspace. For Flask, the extension looks for <code>wsgi.py<\/code>, <code>app.py<\/code>, or <code>init.py<\/code> files that contain the declaration of a Flask application (for example, <code>app = Flask()<\/code>). If none of those files are not found in the project, the dropdown shows a <strong>Default<\/strong> option for the corresponding project type, even though that file may not be present.<\/p>\n<p>In the case your file was not detected, you can enter the file path directly or browse other files in your directory.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/04\/debug_config_flow.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-9663\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/04\/debug_config_flow.gif\" alt=\"Gif of the debug configuration flow for a Flask app.\" width=\"2483\" height=\"1591\" \/><\/a><\/p>\n<h2>Module and import analysis on Jupyter&#8217;s <strong>Run Dependent Cells<\/strong> with Pylance<\/h2>\n<p>Dependency analysis for Jupyter cells has improved with the latest Pylance pre-release. With these changes, Pylance aids Jupyter in understanding module imports, which is especially useful when you have a cell that imports a module that was defined in a previous cell.<\/p>\n<p>To enable this feature, install the latest Pylance pre-release in VS Code Insiders, and enable the <code>jupyter.executionAnalysis.enabled<\/code> and <code>notebook.consolidatedRunButton<\/code> settings.<\/p>\n<h2>Hatch environment discovery<\/h2>\n<p>Hatch environments are now discovered and activated, by default, similar to other common environments, such as Venv, Conda, and Poetry. Furthermore, in the case of Hatch where an explicit environment identifier is not registered, the extension is able to determine the environment type (Hatch) from the environment locator.<\/p>\n<h2>Automatic environment selection for pipenv, pyenv, and Poetry projects<\/h2>\n<p>If your workspace contains a pipenv, pyenv, or Poetry environment, the corresponding environment is now automatically selected for your workspace. Previously, the extension correctly discovered these environments, but selected the default global interpreter, requiring you to manually select the appropriate environment for your workspace. Now, the Python extension infers the default environment based on its presence and any corresponding configuration files. For example, in the case of pyenv, the extension looks at the <code>.python-version<\/code> file to automatically select the appropriate interpreter for the workspace.<\/p>\n<h2>Report Issue command improvements<\/h2>\n<p>The <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">Python<\/a> and <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.debugpy\">Python Debugger<\/a> extensions have adopted changes making it easier for you to report issues to our repos! Filing an issue with the <strong>Report Issue<\/strong> command (<code>workbench.action.openIssueReporter<\/code>) does most of the heavy lifting, prompting you for additional info so our team can efficiently triage the problem you are encountering.<\/p>\n<p>To file an issue using the <strong>Report Issue<\/strong> command for <a href=\"https:\/\/github.com\/microsoft\/vscode-python\">@vscode-python<\/a> or <a href=\"https:\/\/github.com\/microsoft\/vscode-python-debugger\">@vscode-python-debugger<\/a>, choose <strong>Python<\/strong> or <strong>Python Debugger<\/strong> respectively from the extension dropdown.<\/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>Better error messages when &#8220;Move to file&#8221; refactoring fails in <a href=\"https:\/\/github.com\/microsoft\/pylance-release\/issues\/4345\">@pylance-release#4345<\/a><\/li>\n<li>REPL Smart Send (<code>python.REPL.enableREPLSmartSend<\/code>) is now enabled by default<\/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\/bn-d\">@bn-d<\/a> Update minimum VS Code version in <a href=\"https:\/\/github.com\/microsoft\/vscode-black-formatter\/pull\/445\">@vscode-black-formatter#445<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/flying-sheep\">@flying-sheep<\/a> Add support for Hatch environments in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/22779\">@vscode-python#22779<\/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 April 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include an improved debug config flow for Django and Flask, module and import analysis for Run Dependent Cells, Hatch environment discovery, automatic environment selection for popular tools, and Report Issue command improvements. 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],"tags":[17],"class_list":["post-9662","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python"],"acf":[],"blog_post_summary":"<p>The April 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include an improved debug config flow for Django and Flask, module and import analysis for Run Dependent Cells, Hatch environment discovery, automatic environment selection for popular tools, and Report Issue command improvements. Keep reading to learn more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9662","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=9662"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9662\/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=9662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=9662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=9662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}