Skip to content

Commit f66a945

Browse files
authored
Merge branch 'main' into prepared-harrier
2 parents a82aa97 + e572f08 commit f66a945

16 files changed

Lines changed: 1518 additions & 65 deletions
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Please search existing issues first to avoid creating duplicates:
12+
https://github.com/microsoft/vscode-python-environments/issues
13+
-->
14+
15+
## Environment data
16+
17+
<!--
18+
To find extension versions, open the VS Code Extensions panel and locate each
19+
extension from the list of installed extensions. The version appears next to the name.
20+
-->
21+
22+
- Python Environments extension version: XXX
23+
- Python extension (`ms-python.python`) version: XXX
24+
- VS Code version (Help → About): XXX
25+
- OS and version: XXX
26+
- Python version (& distribution if applicable, e.g. Anaconda): XXX
27+
- Environment manager in use (`venv` / `conda` / `pyenv` / `poetry` / `pipenv` / `system` / `uv` / other): XXX
28+
- Shell (bash / zsh / fish / pwsh / cmd / other): XXX
29+
- Remote / container scenario (none / WSL / SSH Remote / Dev Container / Codespaces): XXX
30+
- Workspace type (single folder / multi-root / mono-repo): XXX
31+
- Is this a regression? If yes, last known working extension version: XXX
32+
33+
## Repro Steps
34+
35+
<!--
36+
Please list the minimal steps needed to reproduce the issue, starting from a fresh
37+
VS Code window when possible. If the issue only reproduces with specific workspace
38+
contents (e.g. a `pyproject.toml`, `.venv`, `environment.yml`, `Pipfile`, `poetry.lock`,
39+
`.python-version`), please share a minimal example or describe the layout.
40+
41+
If the bug only reproduces with certain settings, please include the relevant entries
42+
from your `settings.json` (user and/or workspace).
43+
-->
44+
45+
1. XXX
46+
47+
## Expected behavior
48+
49+
XXX
50+
51+
## Actual behavior
52+
53+
XXX
54+
55+
## Logs
56+
57+
<!--
58+
Please include logs from the "Python Environments" output channel.
59+
60+
To capture verbose logs:
61+
1. Open the Output panel (View → Output).
62+
2. Select "Python Environments" from the channel dropdown in the upper-right.
63+
3. Click the gear / filter icon at the top of the Output panel and set the level to "Trace".
64+
(Alternatively: Command Palette → "Developer: Set Log Level…" → "Python Environments" → "Trace".)
65+
4. Reproduce the issue.
66+
5. Paste the relevant output below, or save it to a `.txt` file and attach it to the issue (preferred for long logs).
67+
68+
If the issue is about terminal activation, please also paste the exact terminal
69+
output where the problem occurs.
70+
-->
71+
72+
```
73+
XXX
74+
```
75+
76+
## Additional context
77+
78+
<!--
79+
Anything else that may help us reproduce: screenshots, videos, related issues,
80+
links to your project, workarounds you've tried, etc.
81+
-->
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!-- Please search existing feature requests to avoid creating duplicates. -->
11+
12+
<!-- Describe the feature you'd like. -->

.github/ISSUE_TEMPLATE/question.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Question
3+
about: Ask a question about this project.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Please search existing issues to avoid creating duplicates.
12+
For general Python-in-VS-Code usage questions, consider starting a discussion at
13+
https://github.com/microsoft/vscode-python/discussions/categories/q-a
14+
or checking the issues in the following related repositories:
15+
- Python extension: https://github.com/microsoft/vscode-python/issues
16+
- Pylance: https://github.com/microsoft/pylance-release/issues
17+
- Jupyter: https://github.com/microsoft/vscode-jupyter/issues
18+
- Python Debugger: https://github.com/microsoft/vscode-python-debugger/issues
19+
-->

.github/hooks/scripts/stop_hook.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,12 @@ def main() -> int:
110110
response = {
111111
"hookSpecificOutput": {
112112
"hookEventName": "Stop",
113-
"decision": "block",
113+
"decision": "warn",
114114
"reason": (
115115
"You have uncommitted TypeScript changes. "
116-
"Before finishing, use the run-pre-commit-checks skill "
116+
"Before finishing, consider using the run-pre-commit-checks skill "
117117
"or manually run: npm run lint && npm run compile-tests && npm run unittest. "
118-
"If checks pass and changes are ready, commit them. "
119-
"If this session is just research/exploration, you can proceed without committing."
118+
"Ask the user whether to commit or leave changes uncommitted."
120119
),
121120
}
122121
}
@@ -128,10 +127,10 @@ def main() -> int:
128127
response = {
129128
"hookSpecificOutput": {
130129
"hookEventName": "Stop",
131-
"decision": "block",
130+
"decision": "warn",
132131
"reason": (
133132
"You have staged changes that haven't been committed. "
134-
"Either commit them with a proper message or unstage them before finishing."
133+
"Ask the user whether to commit them or leave them staged."
135134
),
136135
}
137136
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-python-envs",
33
"displayName": "Python Environments",
44
"description": "Provides a unified python environment experience",
5-
"version": "1.28.0",
5+
"version": "1.29.0",
66
"publisher": "ms-python",
77
"preview": true,
88
"engines": {

pythonEnvironmentsApi/src/main.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ export interface QuickCreateConfig {
343343

344344
/**
345345
* Interface representing an environment manager.
346+
*
347+
* @remarks
348+
* Methods on this interface are invoked both by the Python Environments extension itself
349+
* (in response to UI actions, startup, terminal activation, script execution, and so on)
350+
* and directly by other extensions that consume the published API. Any "called when…"
351+
* notes on individual methods list representative triggers only — they are not
352+
* exhaustive, and the precise set of call sites may evolve over time. Implementations
353+
* should focus on the documented contract rather than any specific caller.
346354
*/
347355
export interface EnvironmentManager {
348356
/**
@@ -396,27 +404,44 @@ export interface EnvironmentManager {
396404
* @param scope - The scope within which to create the environment.
397405
* @param options - Optional parameters for creating the Python environment.
398406
* @returns A promise that resolves to the created Python environment, or undefined if creation failed.
407+
*
408+
* @remarks
409+
* Invoked when an environment of this manager's type should be created for the given
410+
* scope. Typical triggers include user-initiated environment-creation flows and
411+
* programmatic creation via the API.
399412
*/
400413
create?(scope: CreateEnvironmentScope, options?: CreateEnvironmentOptions): Promise<PythonEnvironment | undefined>;
401414

402415
/**
403416
* Removes the specified Python environment.
404417
* @param environment - The Python environment to remove.
405418
* @returns A promise that resolves when the environment is removed.
419+
*
420+
* @remarks
421+
* Invoked to delete the given environment. Typical triggers include an explicit user
422+
* action (such as a "Delete Environment" command) and programmatic removal via the API.
406423
*/
407424
remove?(environment: PythonEnvironment): Promise<void>;
408425

409426
/**
410427
* Refreshes the list of Python environments within the specified scope.
411428
* @param scope - The scope within which to refresh environments.
412429
* @returns A promise that resolves when the refresh is complete.
430+
*
431+
* @remarks
432+
* Forces the manager to re-discover environments for the given scope. Typically
433+
* triggered by an explicit user "refresh" action.
413434
*/
414435
refresh(scope: RefreshEnvironmentsScope): Promise<void>;
415436

416437
/**
417438
* Retrieves a list of Python environments within the specified scope.
418439
* @param scope - The scope within which to retrieve environments.
419440
* @returns A promise that resolves to an array of Python environments.
441+
*
442+
* @remarks
443+
* Returns the environments known to this manager for the given scope. Called
444+
* frequently by UI surfaces (tree views, pickers) and by other consumers of the API.
420445
*/
421446
getEnvironments(scope: GetEnvironmentsScope): Promise<PythonEnvironment[]>;
422447

@@ -430,13 +455,27 @@ export interface EnvironmentManager {
430455
* @param scope - The scope within which to set the environment.
431456
* @param environment - The Python environment to set. If undefined, the environment is unset.
432457
* @returns A promise that resolves when the environment is set.
458+
*
459+
* @remarks
460+
* Invoked when the active environment for the given scope should change — for example
461+
* after the user selects an environment in a picker, after a newly created environment
462+
* is auto-selected, or programmatically via the API.
463+
*
464+
* Also invoked at extension startup to rehydrate the active environment from
465+
* persisted state.
433466
*/
434467
set(scope: SetEnvironmentScope, environment?: PythonEnvironment): Promise<void>;
435468

436469
/**
437470
* Retrieves the current Python environment within the specified scope.
438471
* @param scope - The scope within which to retrieve the environment.
439472
* @returns A promise that resolves to the current Python environment, or undefined if none is set.
473+
*
474+
* @remarks
475+
* Returns the currently active environment for the given scope, or `undefined` if
476+
* none is selected. Called very frequently — at startup, after {@link set}, when a
477+
* terminal is opened, before running Python, by UI surfaces that display the active
478+
* interpreter, and by other extensions consuming the API.
440479
*/
441480
get(scope: GetEnvironmentScope): Promise<PythonEnvironment | undefined>;
442481

@@ -456,13 +495,27 @@ export interface EnvironmentManager {
456495
*
457496
* @param context - The context for resolving the environment, which can be a {@link PythonEnvironment} or a {@link Uri}.
458497
* @returns A promise that resolves to the fully detailed {@link PythonEnvironment}, or `undefined` if the environment cannot be resolved.
498+
*
499+
* @remarks
500+
* Called to turn a lightly-populated {@link PythonEnvironment} or a {@link Uri}
501+
* pointing at an interpreter or environment folder into a fully-populated
502+
* {@link PythonEnvironment} with complete {@link PythonEnvironment.execInfo}. Typical
503+
* triggers include the user manually selecting an interpreter path, resolving
504+
* `python.defaultInterpreterPath` at startup, and populating execution details before
505+
* launching Python.
459506
*/
460507
resolve(context: ResolveEnvironmentContext): Promise<PythonEnvironment | undefined>;
461508

462509
/**
463510
* Clears the environment manager's cache.
464511
*
465512
* @returns A promise that resolves when the cache is cleared.
513+
*
514+
* @remarks
515+
* Drops any cached environment data held by the manager so that subsequent calls to
516+
* {@link EnvironmentManager.getEnvironments} or {@link EnvironmentManager.get}
517+
* re-discover state from disk. Typically triggered by an explicit user "clear cache"
518+
* action.
466519
*/
467520
clearCache?(): Promise<void>;
468521
}

0 commit comments

Comments
 (0)