Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit 82ad744

Browse files
authored
fix: use ZDOTDIR when available (#900)
Fixes microsoft/vscode-python-environments#899
1 parent fa90963 commit 82ad744

File tree

3 files changed

+200
-157
lines changed

3 files changed

+200
-157
lines changed

README.md

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Python Environments (preview)
2-
> **Note:** The Python Environments icon may no longer appear in the Activity Bar due to the ongoing rollout of the Python Environments extension. To restore the extension, add `"python.useEnvironmentsExtension": true` to your User settings. This setting is temporarily necessary until the rollout is complete!
2+
3+
> **Note:** The Python Environments icon may no longer appear in the Activity Bar due to the ongoing rollout of the Python Environments extension. To restore the extension, add `"python.useEnvironmentsExtension": true` to your User settings. This setting is temporarily necessary until the rollout is complete!
34
45
## Overview
56

@@ -38,30 +39,31 @@ For more control, you can create a custom environment where you can specify Pyth
3839

3940
The following environment managers are supported out of the box:
4041

41-
| Id | Name | Description |
42-
| ----------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43-
| ms-python.python:venv | `venv` | Built-in environment manager provided by the Python standard library. Supports creating environments (interactive and quick create) and finding existing environments. |
44-
| ms-python.python:system | System Installed Python | Global Python installs on your system, typically installed with your OS, from [python.org](https://www.python.org/), or any other OS package manager. |
42+
| Id | Name | Description |
43+
| ----------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
44+
| ms-python.python:venv | `venv` | Built-in environment manager provided by the Python standard library. Supports creating environments (interactive and quick create) and finding existing environments. |
45+
| ms-python.python:system | System Installed Python | Global Python installs on your system, typically installed with your OS, from [python.org](https://www.python.org/), or any other OS package manager. |
4546
| 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/). Supports creating environments (interactive and quick create) and finding existing environments. |
46-
| ms-python.python:pyenv | `pyenv` | The [pyenv](https://github.com/pyenv/pyenv) environment manager, used to manage multiple Python versions. Supports finding existing environments. |
47-
| ms-python.python:poetry | `poetry` | The [poetry](https://python-poetry.org/) environment manager, used for dependency management and packaging in Python projects. Supports finding existing environments. |
48-
| ms-python.python:pipenv | `pipenv` | The [pipenv](https://pipenv.pypa.io/en/latest/) environment manager, used for managing Python dependencies and environments. Only supports finding existing environments. |
47+
| ms-python.python:pyenv | `pyenv` | The [pyenv](https://github.com/pyenv/pyenv) environment manager, used to manage multiple Python versions. Supports finding existing environments. |
48+
| ms-python.python:poetry | `poetry` | The [poetry](https://python-poetry.org/) environment manager, used for dependency management and packaging in Python projects. Supports finding existing environments. |
49+
| ms-python.python:pipenv | `pipenv` | The [pipenv](https://pipenv.pypa.io/en/latest/) environment manager, used for managing Python dependencies and environments. Only supports finding existing environments. |
4950

5051
#### Supported Actions by Environment Manager
5152

5253
| Environment Manager | Find Environments | Create | Quick Create |
53-
|---------------------|-------------------|--------|--------------|
54-
| venv | | | |
55-
| conda | | | |
56-
| pyenv | | | |
57-
| poetry | | | |
58-
| system | | | |
59-
| pipenv | | | |
54+
| ------------------- | ----------------- | ------ | ------------ |
55+
| venv | | | |
56+
| conda | | | |
57+
| pyenv | | | |
58+
| poetry | | | |
59+
| system | | | |
60+
| pipenv | | | |
6061

6162
**Legend:**
62-
- **Create**: Ability to create new environments interactively.
63-
- **Quick Create**: Ability to create environments with minimal user input.
64-
- **Find Environments**: Ability to discover and list existing environments.
63+
64+
- **Create**: Ability to create new environments interactively.
65+
- **Quick Create**: Ability to create environments with minimal user input.
66+
- **Find Environments**: Ability to discover and list existing environments.
6567

6668
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.
6769

@@ -79,13 +81,13 @@ The extension uses `pip` as the default package manager, but you can use the pac
7981
#### Default Package Manager by Environment Manager
8082

8183
| Environment Manager | Default Package Manager |
82-
|---------------------|------------------------|
83-
| venv | pip |
84-
| conda | conda |
85-
| pyenv | pip |
86-
| poetry | poetry |
87-
| system | pip |
88-
| pipenv | pip |
84+
| ------------------- | ----------------------- |
85+
| venv | pip |
86+
| conda | conda |
87+
| pyenv | pip |
88+
| poetry | poetry |
89+
| system | pip |
90+
| pipenv | pip |
8991

9092
### Project Management
9193

@@ -99,26 +101,27 @@ There are a few ways to add a Python Project from the Python Environments panel:
99101
| ------------ | ---------------------------------------------------------------------- |
100102
| Add Existing | Allows you to add an existing folder from the file explorer. |
101103
| Auto find | Searches for folders that contain `pyproject.toml` or `setup.py` files |
102-
| Create New | Creates a new project from a template. |
104+
| Create New | Creates a new project from a template. |
105+
106+
#### Create New Project from Template
103107

104-
#### Create New Project from Template
105108
The **Python Envs: Create New Project from Template** command simplifies the process of starting a new Python project by scaffolding it for you. Whether in a new workspace or an existing one, this command configures the environment and boilerplate file structure, so you don’t have to worry about the initial setup, and only the code you want to write. There are currently two project types supported:
106109

107-
- Package: A structured Python package with files like `__init__.py` and setup configurations.
108-
- Script: A simple project for standalone Python scripts, ideal for quick tasks or just to get you started.
110+
- Package: A structured Python package with files like `__init__.py` and setup configurations.
111+
- Script: A simple project for standalone Python scripts, ideal for quick tasks or just to get you started.
109112

110113
## Command Reference
111114

112115
All commands can be accessed via the Command Palette (`ctrl/cmd + Shift + P`):
113116

114-
| Name | Description |
115-
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
117+
| Name | Description |
118+
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
116119
| Create Environment | Create a virtual environment using your preferred environment manager preconfigured with "Quick Create" or configured to your choices. |
117120
| Manage Packages | Install and uninstall packages in a given Python environment. |
118121
| Activate Environment in Current Terminal | Activates the currently opened terminal with a particular environment. |
119122
| Deactivate Environment in Current Terminal | Deactivates environment in currently opened terminal. |
120123
| Run as Task | Runs Python module as a task. |
121-
| Create New Project from Template | Creates scaffolded project with virtual environments based on a template. |
124+
| Create New Project from Template | Creates scaffolded project with virtual environments based on a template. |
122125

123126
## Settings Reference
124127

@@ -185,7 +188,7 @@ usage: `await vscode.commands.executeCommand('python-envs.createAny', options);`
185188
The Python Environments extension supports shell startup activation for environments. This feature allows you to automatically activate a Python environment when you open a terminal in VS Code. The activation is done by modifying the shell's startup script, which is supported for the following shells:
186189

187190
- **Bash**: `~/.bashrc`
188-
- **Zsh**: `~/.zshrc`
191+
- **Zsh**: `~/.zshrc` (or `$ZDOTDIR/.zshrc` if `ZDOTDIR` is set)
189192
- **Fish**: `~/.config/fish/config.fish`
190193
- **PowerShell**:
191194
- (Mac/Linux):`~/.config/powershell/profile.ps1`
@@ -255,7 +258,7 @@ fi
255258

256259
### zsh
257260

258-
1. Adds or creates `~/.zshrc`
261+
1. Adds or creates `~/.zshrc` (or `$ZDOTDIR/.zshrc` if `ZDOTDIR` is set)
259262
2. Updates it with following code:
260263

261264
```zsh

0 commit comments

Comments
 (0)