-
Notifications
You must be signed in to change notification settings - Fork 7
Update readme based on most recent updates #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
79d0da1
Initial changes
cwebster-99 aa870dc
Adding Create Project updates
cwebster-99 3b771e0
Updating wording
cwebster-99 7a837b7
reorganizing
cwebster-99 088d145
moving things around
cwebster-99 908cbe8
Add python project button
cwebster-99 e2093b3
Introducing the folds
cwebster-99 b2fb5f4
Pulling in fresh updates
cwebster-99 33793c3
add auto activate setting
cwebster-99 e4993cb
Merge branch 'main' into update-readme
cwebster-99 9915acf
Update README.md
cwebster-99 4b876ea
Update README.md
cwebster-99 a4cfed8
Update README.md
cwebster-99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,103 @@ | ||
# Python Environments and Package Manager (experimental) | ||
# Python Environments (experimental) | ||
|
||
## Overview | ||
|
||
The 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. | ||
The Python Environments 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 for specifying environments for specific files, entire Python folders, or projects, including multi-root and mono-repo scenarios. The core feature set includes: | ||
|
||
> Note: This extension is in preview and its APIs and features are subject to change as the project continues to evolve. | ||
- 🌐 Create, delete, and manage environments | ||
- 📦 Install and uninstall packages within the selected environment | ||
- ✅ Create activated terminals | ||
- 🖌️ Add and create new Python projects | ||
|
||
> Important: This extension currently requires the pre-release version of the Python extension (ms-python.python) to operate (version 2024.23.2025010901 or later). | ||
> **Note:** This extension is in preview, and its APIs and features are subject to change as the project evolves. | ||
|
||
> **Important:** This extension requires version `2024.23`, or later, of the Python extension (`ms-python.python`). | ||
|
||
## Features | ||
|
||
<img src=https://raw.githubusercontent.com/microsoft/vscode-python-environments/main/images/python-envs-overview.gif width=734 height=413> | ||
The "Python Projects" fold shows you all of the projects that are currently in your workspace and their selected environments. From this view you can add more files or folders as projects, select a new environment for your project, and manage your selected environments. | ||
|
||
The "Environment Managers" fold shows you all of the environment managers that are available on your machine with all related environments nested below. From this view, you can create new environments, delete old environments, and manage packages. | ||
|
||
<img src=<https://raw.githubusercontent.com/microsoft/vscode-python-environments/main/images/python-envs-overview.gif> width=734 height=413> | ||
|
||
### Environment Management | ||
|
||
This 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. | ||
The Python Environments panel provides an interface to create, delete and manage environments. | ||
|
||
<img src=<https://raw.githubusercontent.com/microsoft/vscode-python-environments/main/images/environment-managers-quick-start.png> width=734 height=413> | ||
Comment on lines
+22
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The image source attribute uses nested angle brackets. Consider removing the extra angle brackets to ensure consistent Markdown/HTML rendering. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
|
||
To simplify the environment creation process, you can use "Quick Create" to automatically create a new virtual environment using: | ||
|
||
By default, the extension uses the `venv` environment manager. This default manager determines how environments are created, managed, and where packages are installed. However, users can change the default by setting the `python-envs.defaultEnvManager` to a different environment manager. The following environment managers are supported out of the box: | ||
- Your default environment manager (e.g., `venv`) | ||
- The latest Python version | ||
- Workspace dependencies | ||
|
||
| Id | name | Description | | ||
For more control, you can create a custom environment where you can specify Python version, environment name, packages to be installed, and more! | ||
|
||
The following environment managers are supported out of the box: | ||
|
||
| Id | Name | Description | | ||
| ----------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| ms-python.python:venv | `venv` | The default environment manager. It is a built-in environment manager provided by the Python standard library. | | ||
| ms-python.python:system | System Installed Python | These are global Python installs on your system. These are typically installed with your OS, from [python.org](https://www.python.org/), or any other OS package manager. | | ||
| ms-python.python:conda | `conda` | The [conda](https://conda.org) environment manager, as provided by conda distributions like [Anaconda Distribution](https://docs.anaconda.com/anaconda/) or [conda-forge](https://conda-forge.org/download/). | | ||
|
||
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. | ||
Environment managers are responsible for specifying which package manager will be used by default to install and manage Python packages within the environment (`venv` uses `pip` by default). This ensures that packages are managed consistently according to the preferred tools and settings of the chosen environment manager. | ||
|
||
### Package Management | ||
|
||
This 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 also provides an interface to install and uninstall Python packages, and provides APIs for extension developers to contribute package managers of their choice. | ||
|
||
The extension uses `pip` as the default package manager. You can change this by setting the `python-envs.defaultPackageManager` setting to a different package manager. The following are package managers supported out of the box: | ||
The extension uses `pip` as the default package manager, but you can use the package manager of your choice using the `python-envs.defaultPackageManager` setting. The following are package managers supported out of the box: | ||
|
||
| Id | name | Description | | ||
| Id | Name | Description| | ||
| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| ms-python.python:pip | `pip` | Pip acts as the default package manager and it's typically built-in to Python. | | ||
| ms-python.python:conda | `conda` | The [conda](https://conda.org) package manager, as provided by conda distributions like [Anaconda Distribution](https://docs.anaconda.com/anaconda/) or [conda-forge](https://conda-forge.org/download/). | | ||
|
||
### Project Management | ||
|
||
A "Python Project" is any file or folder that contains runnable Python code and needs its own environment. With the Python Environments extension, you can add files and folders as projects in your workspace and assign individual environments to them allowing you to run various projects more seamlessly. | ||
|
||
Projects can be added via the Python Environments pane or in the File Explorer by right-clicking on the folder/file and selecting the "Add as Python Project" menu item. | ||
|
||
There are a couple of ways that you can add a Python Project from the Python Environments panel: | ||
|
||
| Name | Description | | ||
| ----- | ---------- | | ||
| Add Existing | Allows you to add an existing folder from the file explorer. | | ||
| Auto find | Searches for folders that contain `pyproject.toml` or `setup.py` files | | ||
|
||
## Command Reference | ||
|
||
| Name | Description | | ||
| -------- | ------------- | | ||
| Python: Create Environment | Create a virtual environment using your preferred environment manager preconfigured with "Quick Create" or configured to your choices. | | ||
| Python: Manage Packages | Install and uninstall packages in a given Python environment. | | ||
| Python: Activate Environment in Current Terminal | Activates the currently opened terminal with a particular environment. | | ||
| Python: Deactivate Environment in Current Terminal | Deactivates environment in currently opened terminal. | | ||
| Python: Run as Task | Runs Python module as a task. | | ||
|
||
## Settings Reference | ||
|
||
| Setting (python-envs.) | Default | Description | | ||
| --------------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| defaultEnvManager | `"ms-python.python:venv"` | The default environment manager used for creating and managing environments. | | ||
| defaultPackageManager | `"ms-python.python:pip"` | The default package manager to use for installing and managing packages. This is often dictated by the default environment manager but can be customized. | | ||
| defaultEnvManager | `"ms-python.python:venv"` | The default environment manager used for creating and managing environments. | | ||
| defaultPackageManager | `"ms-python.python:pip"` | The default package manager to use for installing and managing packages. This is often dictated by the default environment manager but can be customized. | | ||
| pythonProjects | `[]` | A list of Python workspaces, specified by the path, in which you can set particular environment and package managers. You can set information for a workspace as `[{"path": "/path/to/workspace", "envManager": "ms-python.python:venv", "packageManager": "ms-python.python:pip"]}`. | | ||
| terminal.showActivateButton | `false` | [experimental] Show a button in the terminal to activate/deactivate the current environment for the terminal. This button is only shown if the active terminal is associated with a project that has an activatable environment. | | ||
| terminal.showActivateButton | `false` | (experimental) Show a button in the terminal to activate/deactivate the current environment for the terminal. This button is only shown if the active terminal is associated with a project that has an activatable environment. | | ||
| python-envs.terminal.autoActivationType | `command` | Specifies how the extension can activate an environment in a terminal. Utilizing Shell Startup requires changes to the shell script file and is only enabled for the following shells: zsh, fsh, pwsh, bash, cmd. When set to `command`, any shell can be activated. This setting applies only when terminals are created, so you will need to restart your terminals for it to take effect. To revert changes made during shellStartup, run `Python Envs: Revert Shell Startup Script Changes`.| | ||
|
||
## Extensibility | ||
|
||
## API Reference (proposed) | ||
The Python Environments extension was built to provide a cohesive and user friendly experience with `venv` as the default. However, the extension is built with extensibility in mind so that any environment manager could build an extension using the supported APIs to plug-in and provide a seamless and incorporated experience for their users in VS Code. | ||
|
||
### API Reference (proposed) | ||
|
||
See [api.ts](https://github.com/microsoft/vscode-python-environments/blob/main/src/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/examples/README.md | ||
To consume these APIs you can look at the example here: [API Consumption Examples](https://github.com/microsoft/vscode-python-environments/blob/main/examples/README.md) | ||
|
||
### Callable Commands | ||
|
||
|
@@ -77,23 +123,24 @@ Create a new environment using any of the available environment managers. This c | |
|
||
usage: `await vscode.commands.executeCommand('python-envs.createAny', options);` | ||
|
||
|
||
## Extension Dependency | ||
|
||
This 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: | ||
|
||
- **Debuggers** (e.g., `debugpy`) | ||
- **Linters** (e.g., Pylint, Flake8, Mypy) | ||
- **Formatters** (e.g., Black, autopep8) | ||
- **Language Server extensions** (e.g., Pylance, Jedi) | ||
- **Environment and Package Manager extensions** (e.g., Pixi, Conda, Hatch) | ||
- **Debuggers** (e.g., `debugpy`) | ||
- **Linters** (e.g., Pylint, Flake8, Mypy) | ||
- **Formatters** (e.g., Black, autopep8) | ||
- **Language Server extensions** (e.g., Pylance, Jedi) | ||
- **Environment and Package Manager extensions** (e.g., Pixi, Conda, Hatch) | ||
|
||
### API Dependency | ||
|
||
The relationship between these extensions can be represented as follows: | ||
|
||
<img src=https://raw.githubusercontent.com/microsoft/vscode-python-environments/refs/heads/main/images/extension_relationships.png width=734 height=413> | ||
<img src=<https://raw.githubusercontent.com/microsoft/vscode-python-environments/refs/heads/main/images/extension_relationships.png> width=734 height=413> | ||
|
||
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. | ||
|
||
|
@@ -103,15 +150,15 @@ VS Code supports trust management, allowing extensions to function in either **t | |
|
||
The relationship is illustrated below: | ||
|
||
<img src=https://raw.githubusercontent.com/microsoft/vscode-python-environments/refs/heads/main/images/trust_relationships.png width=734 height=413> | ||
<img src=<https://raw.githubusercontent.com/microsoft/vscode-python-environments/refs/heads/main/images/trust_relationships.png> width=734 height=413> | ||
|
||
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. | ||
|
||
## Contributing | ||
|
||
This 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. | ||
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 | ||
|
@@ -123,17 +170,17 @@ contact [[email protected]](mailto:[email protected]) with any additio | |
|
||
## Questions, issues, feature requests, and contributions | ||
|
||
- If you have a question about how to accomplish something with the extension, please [ask on our Discussions page](https://github.com/microsoft/vscode-python/discussions/categories/q-a). | ||
- If you come across a problem with the extension, please [file an issue](https://github.com/microsoft/vscode-python). | ||
- Contributions are always welcome! Please see our [contributing guide](https://github.com/Microsoft/vscode-python/blob/main/CONTRIBUTING.md) for more details. | ||
- Any and all feedback is appreciated and welcome! | ||
- If someone has already [filed an issue](https://github.com/Microsoft/vscode-python) that encompasses your feedback, please leave a 👍/👎 reaction on the issue. | ||
- Otherwise please start a [new discussion](https://github.com/microsoft/vscode-python/discussions/categories/ideas). | ||
- If you're interested in the development of the extension, you can read about our [development process](https://github.com/Microsoft/vscode-python/blob/main/CONTRIBUTING.md#development-process). | ||
- If you have a question about how to accomplish something with the extension, please [ask on our Discussions page](https://github.com/microsoft/vscode-python/discussions/categories/q-a). | ||
- If you come across a problem with the extension, please [file an issue](https://github.com/microsoft/vscode-python). | ||
- Contributions are always welcome! Please see our [contributing guide](https://github.com/Microsoft/vscode-python/blob/main/CONTRIBUTING.md) for more details. | ||
- Any and all feedback is appreciated and welcome! | ||
- If someone has already [filed an issue](https://github.com/Microsoft/vscode-python) that encompasses your feedback, please leave a 👍/👎 reaction on the issue. | ||
- Otherwise please start a [new discussion](https://github.com/microsoft/vscode-python/discussions/categories/ideas). | ||
- If you're interested in the development of the extension, you can read about our [development process](https://github.com/Microsoft/vscode-python/blob/main/CONTRIBUTING.md#development-process). | ||
|
||
## Data and telemetry | ||
|
||
The 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](https://privacy.microsoft.com/privacystatement) to learn more. This extension respects the `telemetry.enableTelemetry` setting which you can learn more about at https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting. | ||
The 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](https://privacy.microsoft.com/privacystatement) to learn more. This extension respects the `telemetry.enableTelemetry` setting which you can learn more about at <https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting>. | ||
|
||
## Trademarks | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should elaborate that a project in this case is anything that requires its own python environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I go into detail about a project starting on line 59, is this ok?