{"id":8796,"date":"2021-12-09T13:30:10","date_gmt":"2021-12-09T21:30:10","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=8796"},"modified":"2021-12-09T13:30:10","modified_gmt":"2021-12-09T21:30:10","slug":"python-in-visual-studio-code-december-2021-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-december-2021-release\/","title":{"rendered":"Python in Visual Studio Code \u2013 December 2021 Release"},"content":{"rendered":"<p>We are pleased to announce that the December 2021 release of the Python Extension for Visual Studio Code is now available. You can <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">download the Python extension<\/a> from the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. 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.<\/p>\n<p>This announcement includes:<\/p>\n<ul>\n<li>Module rename refactoring with change preview, via Pylance<\/li>\n<li>A rich editing experience when working with virtual or untrusted workspaces<\/li>\n<li>An update regarding debugging with Python 2.7<\/li>\n<li>A community highlight: Don Jayamanne\u2019s new Python environment management extension<\/li>\n<\/ul>\n<p>If you\u2019re interested, you can check the full list of improvements included in this release in our <a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/blob\/master\/CHANGELOG.md\">changelog<\/a>.<\/p>\n<h2>Module rename with change preview<\/h2>\n<p>One of our most heavily requested features is finally here! As of this release, you can now more easily refactor your code using a new rename refactoring experience, via Pylance.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/12\/Dec2021-ModuleRenameV2.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-8797\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/12\/Dec2021-ModuleRenameV2.gif\" alt=\"Renaming a module with Pylance's new file\/folder rename refactoring\" width=\"2018\" height=\"1238\" \/><\/a><\/p>\n<p>Previously, when you renamed a file\/module, you would have searched for references to that module in your codebase and update each location manually.<\/p>\n<p>As of this release, after renaming a Python file\/module, Pylance will find all the instances that need to be updated and provide you with a preview of all the changes to be made. If you want to customize the references to be updated, you can toggle check boxes at the line or file level at the preview stage before accepting the changes. You can also change your mind after seeing what would be changed at the preview stage and discard all changes.<\/p>\n<p>With this preview, you can feel even more confident in the changes that are being made to your code and still save time when refactoring.<\/p>\n<h2>Rich Python editing experience when working with virtual or untrusted workspaces<\/h2>\n<p>The Python extension now offers syntax error detection and limited IntelliSense support when using virtual or untrusted workspaces via Pylance. Just like when using github.dev or vscode.dev, you can now take advantage of a series of editing features you might want when exploring a codebase virtually, or when inspecting the workspace locally to decide whether you\u2019ll mark it as trusted.<\/p>\n<p>The feature set includes:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/python\/pylance-has-reached-stable\/#semantic-colorization\">Semantic highlighting<\/a><\/li>\n<li>Completions for built-ins, Pylance\u2019s bundled stubs, locally defined symbols in the current file, and symbols in open files<\/li>\n<li>Syntax errors<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/python\/pylance-has-reached-stable\/#code-navigation\">Code navigation<\/a><\/li>\n<li>Outline support<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/python\/pylance-has-reached-stable\/#function-signature-help-with-parameter-and-return-type-information\">Function signature help<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/python\/pylance-has-reached-stable\/#contextual-document-highlighting\">Contextual document highlighting<\/a><\/li>\n<\/ul>\n<p>We\u2019re excited for you to give this new experience a try and welcome any feedback on the\u00a0<a href=\"https:\/\/github.com\/microsoft\/pylance-release\">Pylance issue tracker.<\/a><\/p>\n<h2>An update on debugging with Python 2.7<\/h2>\n<p>Following up <a href=\"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-september-2021-release\/\">last September\u2019s announcement<\/a> on limited IntelliSense support for Python 2.7, this is the last release with support for debugging locally with Python 2.7. This is because our debugger, <a href=\"http:\/\/github.com\/microsoft\/debugpy\">debugpy<\/a>, will <a href=\"https:\/\/github.com\/microsoft\/debugpy\/issues\/799\">no longer Python 2.7<\/a> starting in January 2022.<\/p>\n<p>This change should impact only the local experience, and not remote debugging &#8211; attaching the debugger to remote processes running in Python 2.7 will still be supported.<\/p>\n<h2>Python Environment Manager extension<\/h2>\n<p>You can now inspect your Python environments and its packages with the <a href=\"https:\/\/github.com\/DonJayamanne\/vscode-python-manager\">Python Environment Manager extension<\/a>! This extension is developed and maintained by Don Jayamanne, a member of our team and the <a href=\"https:\/\/devblogs.microsoft.com\/python\/don-jayamanne-joins-microsoft\/\">creator of the Python extension<\/a>. While not an official Microsoft extension, we wanted to give it a shout-out to help spread the word about it!<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/12\/Dec2021-PythonEnvManager.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-8798\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2021\/12\/Dec2021-PythonEnvManager.gif\" alt=\"Visualizing information and packages of Python environments with the Python environment manager extension\" width=\"2210\" height=\"1192\" \/><\/a><\/p>\n<p>With the Python environment manager, you can open the manager view and see information on multiple Python environments located on your machine &#8211; even virtual environments not located in your workspace. You can then check which packages are installed in that environment as well as their versions.<\/p>\n<p>You can also create multiple terminals for different environments \u2013 once you click on the terminal icon next to an environment, it will automatically activate it.<\/p>\n<p>If you have any feedback or feature requests, you can file an issue on the Python environment manager\u2019s <a href=\"https:\/\/github.com\/DonJayamanne\/vscode-python-manager\">GitHub repository<\/a>.<\/p>\n<h2>Other Changes and Enhancements<\/h2>\n<p>We would also like to extend special thanks to this month\u2019s contributors:<\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/bhrutledge\">Brian Rutledge<\/a>: Partial fix for using the same directory as discovery when running tests (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/9553\">#9553<\/a>), &#8211;rootdiris no longer interpreted as a test folder when using pytest (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/16079\">#16079<\/a>), and fix for\u00a0pytest\u00a0run all tests when using\u00a0ini\u00a0and\u00a0cwd. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/17546\">#17546<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/mjpieters\">Martijn Pieters<\/a>: Fix for issue with parsing pytest node ids. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/17676\">#17676<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/ssbarnea\">Sorin Sbarnea<\/a>: Ensure that path towards external tools like linters are not synched between machines. (<a href=\"https:\/\/github.com\/microsoft\/vscode-python\/pull\/18008\">#18008<\/a>)<\/li>\n<\/ol>\n<p>Be sure to\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">download the Python extension<\/a>\u00a0for Visual Studio Code now to try out the above improvements. 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\u00a0<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\">Python VS Code GitHub<\/a>\u00a0page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are happy to announce that the December 2021 release of the Python Extension for VS Code is now available. This announcement includes a new refactoring option via Pylance, rich editing support for virtual or untrusted workspaces, an update regarding debugging with Python 2.7 and a community highlight: a Python package manager extension. <\/p>\n","protected":false},"author":33429,"featured_media":8797,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,6],"tags":[],"class_list":["post-8796","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-visual-studio-code"],"acf":[],"blog_post_summary":"<p>We are happy to announce that the December 2021 release of the Python Extension for VS Code is now available. This announcement includes a new refactoring option via Pylance, rich editing support for virtual or untrusted workspaces, an update regarding debugging with Python 2.7 and a community highlight: a Python package manager extension. <\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/8796","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\/33429"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/comments?post=8796"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/8796\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/8797"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=8796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=8796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=8796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}