Python Environments and Package Manager (preview)OverviewThe Python Environments and Package Manager extension for VS Code helps you manage Python environments and packages using your preferred environment manager backed by its extensible APIs. This extension provides unique support to specify environments for specific files or whole Python folders or projects, including multi-root & mono-repos scenarios.
FeaturesEnvironment ManagementThis extension provides an Environments view, which can be accessed via the VS Code Activity Bar, where you can manage your Python environments. Here, you can create, delete, and switch between environments, as well as install and uninstall packages within the selected environment. It also provides APIs for extension developers to contribute their own environment managers. By default, the extension uses the
The environment manager is responsible for specifying which package manager will be used by default to install and manage Python packages within the environment. This ensures that packages are managed consistently according to the preferred tools and settings of the chosen environment manager. Package ManagementThis extension provides a package view for you to manage, install and uninstall you Python packages in any particular environment. This extension provides APIs for extension developers to contribute package managers. The extension uses
Settings Reference
API Reference (proposed)See api.ts for the full list of Extension APIs. To consume these APIs you can look at the example here: https://github.com/microsoft/vscode-python-environments/blob/main/src/examples/README.md Extension DependencyThis section provides an overview of how the Python extension interacts with the Python Environments extension and other tool-specific extensions. The Python Environments extension allows users to create, manage, and remove Python environments and packages. It also provides an API that other extensions can use to support environment management or consume it for running Python tools or projects. Tools that may rely on these APIs in their own extensions include:
API DependencyThe relationship between these extensions can be represented as follows: Users who do not need to execute code or work in Virtual Workspaces can use the Python extension to access language features like hover, completion, and go-to definition. However, executing code (e.g., running a debugger, linter, or formatter), creating/modifying environments, or managing packages requires the Python Environments extension to enable these functionalities. Trust Relationship Between Python and Python Environments ExtensionsVS Code supports trust management, allowing extensions to function in either trusted or untrusted scenarios. Code execution and tools that can modify the user’s environment are typically unavailable in untrusted scenarios. The relationship is illustrated below: In trusted mode, the Python Environments extension supports tasks like managing environments, installing/removing packages, and running tools. In untrusted mode, functionality is limited to language features, ensuring a secure and restricted environment. ContributingThis project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. Questions, issues, feature requests, and contributions
Data and telemetryThe Microsoft Python Extension for Visual Studio Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. This extension respects the TrademarksThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies. |