{"id":9341,"date":"2023-05-04T07:51:30","date_gmt":"2023-05-04T15:51:30","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=9341"},"modified":"2023-05-04T07:52:57","modified_gmt":"2023-05-04T15:52:57","slug":"python-in-visual-studio-code-may-2023-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-may-2023-release\/","title":{"rendered":"Python in Visual Studio Code &#8211; May 2023 Release"},"content":{"rendered":"<p>We\u2019re excited to announce that the May 2023 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>Jupyter extension no longer installed by default<\/li>\n<li>Microvenv support for Create Environment command<\/li>\n<li>Automatic conversion of f-strings with Pylance<\/li>\n<li>Code navigation enabled on strings that contain module names<\/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>Microvenv support for Create Environment command<\/h2>\n<p>When the <strong>Python: Create environment<\/strong> command is invoked using a Python distribution that doesn&#8217;t have the <code>venv<\/code> package installed, the Python extension now uses <a href=\"https:\/\/github.com\/brettcannon\/microvenv\">microvenv<\/a> as a fallback. This can be a hurdle for Python environments that are pre-installed on Unix-based systems, which causes the <strong>Python: Create Environment<\/strong> command to fail.<\/p>\n<p>Microvenv is a lightweight Python module that offers a minimalist approach to creating virtual environments for your Python projects. It is not equipped with traditional activation scripts like virtual environments, but it provides a good alternative for creating an isolated environment when the <code>venv<\/code> module is not available in your Python distribution.<\/p>\n<p>The <strong>Python: Create Environment<\/strong> command will also install <code>pip<\/code> into the environments created via <code>microvenv<\/code>.<\/p>\n<h2>Jupyter extension no longer installed by default<\/h2>\n<p>The <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-toolsai.jupyter\">Jupyter<\/a> extension is no longer automatically installed alongside the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">Python<\/a> extension by default. This change was made in response to <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/18073\">feedback<\/a> from <a href=\"https:\/\/code.visualstudio.com\/docs\/devcontainers\/containers\">Dev Containers<\/a> users who wanted a faster container creation process.<\/p>\n<p>If you have Dev Container definitions that only list the Python extension and wish to continue using the Jupyter notebooks features in your containers, you can add the Jupyter extension ID to your <code>devcontainer.json<\/code> file:<\/p>\n<pre><code>  \"customizations\": {\r\n    \"vscode\": {\r\n      \"extensions\": [\"ms-python.vscode-pylance\", \"ms-python.python\", \"ms-toolsai.jupyter\"]\r\n    }\r\n  }<\/code><\/pre>\n<p>Alternatively, you can create a <a href=\"https:\/\/code.visualstudio.com\/docs\/editor\/profiles\">Profile<\/a> that includes the Python and Jupyter extensions, as well as any other of your favorite extensions.<\/p>\n<h2>Automatic conversion of f-strings with Pylance<\/h2>\n<p>There&#8217;s a new <code>\"python.analysis.autoFormatStrings\"<\/code> setting that enables automatic conversion of strings to f-strings when using Pylance. Once enabled, Pylance will automatically insert an <code>f<\/code> at the beginning of a string when you insert <code>{<\/code> within quotes.<\/p>\n<p>This setting is currently disabled by default, but it is expected to be enabled in the upcoming release pending positive feedback. If you have any comments or suggestions regarding this feature, please feel free to share them on the <a href=\"https:\/\/github.com\/microsoft\/pylance-release\">Pylance GitHub repository<\/a>.<\/p>\n<h2>Code navigation enabled on strings that contain module names<\/h2>\n<p>There&#8217;s another new experimental setting called <code>\"python.analysis.gotoDefinitionInStringLiteral\"<\/code> that enables <strong>Go to Definition<\/strong> from module-like string literals. This can be particularly helpful if you&#8217;re working on web applications, such as Django apps, and want to navigate to modules defined in string literals.<\/p>\n<p>This new setting, like the <code>autoFormatStrings<\/code> setting mentioned earlier, is currently disabled by default. However, we plan to enable this behavior by default in the next release based on feedback. Eventually, we plan to remove this setting entirely.<\/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>Run Python actions are now in sub-menus <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/issues\/14350\">(vscode-python#14350)<\/a><\/li>\n<li>Black formatter and Autopep8 extension recommendations<\/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\/flying-sheep\">@flying-sheep<\/a> made their first contribution in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/20842\">vscode-python#20842<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/aidoskanapyanov\">@aidoskanapyanov<\/a> made their first contribution in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/21048\">vscode-python#21048<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/pamelafox\">@pamelafox<\/a> made their first contribution in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/21095\">vscode-python#21095<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/r3m0t\">@r3m0t<\/a> made their first contribution in <a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/21118\">vscode-python#21118<\/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 May 2023 release of the Python and Jupyter extensions for Visual Studio Code are now available. In this release, Jupyter is no longer installed alongside the Python extension, microvenv support was added for the Create Environment command, new automatic conversion of f-strings, and code navigation on strings that contain module names. 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-9341","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python"],"acf":[],"blog_post_summary":"<p>The May 2023 release of the Python and Jupyter extensions for Visual Studio Code are now available. In this release, Jupyter is no longer installed alongside the Python extension, microvenv support was added for the Create Environment command, new automatic conversion of f-strings, and code navigation on strings that contain module names. Keep reading to learn more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9341","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=9341"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/9341\/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=9341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=9341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=9341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}