{"id":9820,"date":"2024-09-06T05:50:48","date_gmt":"2024-09-06T13:50:48","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=9820"},"modified":"2024-09-06T05:52:19","modified_gmt":"2024-09-06T13:52:19","slug":"python-in-visual-studio-code-september-2024-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-september-2024-release\/","title":{"rendered":"Python in Visual Studio Code &#8211; September 2024 Release"},"content":{"rendered":"<p>We&#8217;re excited to announce the September 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>Django unit test support<\/li>\n<li>Go to definition from inlay hints with Pylance<\/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>Django unit test support<\/h2>\n<p>We are excited to announce support for one of our most <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/73\">requested features<\/a>: you can now discover and run Django unit tests through the Test Explorer!<\/p>\n<p>In order to enable this feature, you will need to add a <code>MANAGE_PY_PATH<\/code> environment variable, pointing to your Django application&#8217;s manage.py file. To do so, you can follow these steps:<\/p>\n<ol>\n<li>Set <code>\"python.testing.unittestEnabled\": true,<\/code> in your <code>settings.json<\/code> <a href=\"\/docs\/getstarted\/settings.md#settingsjson\">file<\/a>.<\/li>\n<li>Add <code>MANAGE_PY_PATH<\/code> as an environment variable:\n<ol>\n<li>Create a <code>.env<\/code> file at the root of your project.<\/li>\n<li>Add <code>MANAGE_PY_PATH='&lt;path-to-manage.py&gt;'<\/code> to the <code>.env<\/code> file, replacing <code>&lt;path-to-manage.py&gt;<\/code> with the path to your application&#8217;s <code>manage.py<\/code> file.\n<blockquote><p><strong>Tip<\/strong>: You can copy the path by right clicking on the file in the Explorer view and selecting <strong>Copy Path<\/strong>.<\/p><\/blockquote>\n<\/li>\n<\/ol>\n<\/li>\n<li>Add Django test arguments to <code>\"python.testing.unittestArgs\": []<\/code> in the <code>settings.json<\/code> <a href=\"\/docs\/getstarted\/settings.md#settingsjson\">file<\/a> as needed, and remove any arguments that are not compatible with Django.<\/li>\n<\/ol>\n<blockquote><p><strong>Note<\/strong>: By default, the Python extension looks for and loads <code>.env<\/code> files at the project root. If your <code>.env<\/code> file is not at the project root or you are using <a href=\"https:\/\/code.visualstudio.com\/docs\/editor\/variables-reference\">VS Code variable substitution<\/a>, add <code>\"python.envFile\": \"${workspaceFolder}\/&lt;path-to-.env&gt;\"<\/code> to your <code>settings.json<\/code> <a href=\"\/docs\/getstarted\/settings.md#settingsjson\">file<\/a>, so the Python extension can load the environment variables in this file when running and discovering tests. See our <a href=\"https:\/\/code.visualstudio.com\/docs\/python\/environments#_environment-variables\">Python environment variables<\/a> docs for more information on environment variables.<\/p><\/blockquote>\n<p>Navigate to the Testing view, and select the <strong>Refresh Tests<\/strong> button to have your Django tests displayed!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/09\/django-unittests.png\" alt=\"Django tests displayed in the Test Explorer.\" \/><\/p>\n<p>For troubleshooting tips, please see our <a href=\"https:\/\/code.visualstudio.com\/docs\/python\/testing#_django-unit-tests\">Django testing docs<\/a>. As you explore this newly added feature, please provide feedback and report any issues in our <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\">vscode-python repo<\/a> or by using the <strong>Python: Report Issue<\/strong> command.<\/p>\n<h2>Go to definition from inlay hints with Pylance<\/h2>\n<p>When enabling inlay hints with Pylance, you can now more conveniently navigate to a type&#8217;s definition through <code>Ctrl+Click<\/code> or <code>Cmd+Click<\/code> when hovering over it.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2024\/09\/pylance-gotodef-inlayhints.png\" alt=\"Python type through an inlay hint hover showing Go to Definition by using Ctrl\/Cmd + click\" \/><\/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>You can now access the <a href=\"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-june-2024-release\/\">VS Code Native REPL for Python<\/a> from the Command Palette (<code>Ctrl\/Cmd + Shift + P<\/code>) using <code>Python: Start Native REPL<\/code><a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/23727\">(@vscode-python#23727)<\/a><\/li>\n<li>VS Code Native REPL for Python now starts at the project folder <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/23821\">(@vscode-python#23821)<\/a><\/li>\n<li>Strings are now normalized when sending commands to the VS Code Native REPL <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/23743\">(@vscode-python#23743)<\/a><\/li>\n<li>You can now restart the debugger when debugging tests through the debug control widget <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/23752\">(@vscode-python#23752)<\/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 September 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include Django test support. Keep reading to learn more!<\/p>\n","protected":false},"author":99209,"featured_media":9822,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,6],"tags":[17,1261,1270],"class_list":["post-9820","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-visual-studio-code","tag-python","tag-release","tag-vscode"],"acf":[],"blog_post_summary":"<p>The September 2024 release of the Python and Jupyter extensions for Visual Studio Code are now available. This month&#8217;s updates include Django test support. Keep reading to learn more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9820","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=9820"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9820\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/9822"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=9820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=9820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=9820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}