@vscode/python-environments 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +17 -0
- package/out/cjs/main.cjs +23 -72
- package/out/cjs/publicErrors.js +55 -0
- package/out/cjs/types.js +33 -0
- package/out/esm/main.mjs +8 -69
- package/out/esm/package.json +1 -0
- package/out/esm/publicErrors.js +50 -0
- package/out/esm/types.js +30 -0
- package/out/types/main.d.ts +10 -0
- package/out/types/publicErrors.d.ts +31 -0
- package/out/{cjs/main.d.ts → types/types.d.ts} +16 -55
- package/package.json +10 -7
- package/out/esm/main.d.ts +0 -1316
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to the `@vscode/python-environments` API package are documen
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.4.0]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Reorganized the package source into separate API facade, public contract, and public error modules without changing the root package exports.
|
|
13
|
+
|
|
8
14
|
## [1.3.0]
|
|
9
15
|
|
|
10
16
|
### Added
|
package/README.md
CHANGED
|
@@ -35,3 +35,20 @@ export async function activate() {
|
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
## Full API reference
|
|
39
|
+
|
|
40
|
+
📘 **[Python Environments API reference](https://github.com/microsoft/vscode-python-environments/blob/main/docs/README.md)**
|
|
41
|
+
|
|
42
|
+
The complete manual documents every method and data type, organized by domain -
|
|
43
|
+
environments, packages, projects, execution, environment variables, and
|
|
44
|
+
extensibility - with field tables, parameter tables, return types, and examples.
|
|
45
|
+
|
|
46
|
+
- [Environments](https://github.com/microsoft/vscode-python-environments/blob/main/docs/README.md#environments) - discover, resolve, select, create, and remove interpreters
|
|
47
|
+
- [Packages](https://github.com/microsoft/vscode-python-environments/blob/main/docs/README.md#packages) - list, install, uninstall, and look up versions
|
|
48
|
+
- [Projects](https://github.com/microsoft/vscode-python-environments/blob/main/docs/README.md#projects) - the folders the extension tracks
|
|
49
|
+
- [Execution](https://github.com/microsoft/vscode-python-environments/blob/main/docs/README.md#execution) - run Python in terminals, tasks, and background processes
|
|
50
|
+
- [Environment variables](https://github.com/microsoft/vscode-python-environments/blob/main/docs/README.md#environment-variables) - resolved variables for a scope
|
|
51
|
+
- [Extensibility](https://github.com/microsoft/vscode-python-environments/blob/main/docs/README.md#extensibility) - register your own environment manager, package manager, or project creator
|
|
52
|
+
|
|
53
|
+
See [`CHANGELOG.md`](https://github.com/microsoft/vscode-python-environments/blob/main/api/CHANGELOG.md) for API changes between versions.
|
|
54
|
+
|
package/out/cjs/main.cjs
CHANGED
|
@@ -1,82 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
4
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.PythonEnvironments = exports.EXTENSION_ID =
|
|
6
|
-
exports.isPackageVersionLookupNotSupportedError = isPackageVersionLookupNotSupportedError;
|
|
19
|
+
exports.PythonEnvironments = exports.EXTENSION_ID = void 0;
|
|
7
20
|
const vscode_1 = require("vscode");
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
var EnvironmentChangeKind;
|
|
12
|
-
(function (EnvironmentChangeKind) {
|
|
13
|
-
/**
|
|
14
|
-
* Indicates that an environment was added.
|
|
15
|
-
*/
|
|
16
|
-
EnvironmentChangeKind["add"] = "add";
|
|
17
|
-
/**
|
|
18
|
-
* Indicates that an environment was removed.
|
|
19
|
-
*/
|
|
20
|
-
EnvironmentChangeKind["remove"] = "remove";
|
|
21
|
-
})(EnvironmentChangeKind || (exports.EnvironmentChangeKind = EnvironmentChangeKind = {}));
|
|
22
|
-
/**
|
|
23
|
-
* Enum representing the kinds of package changes.
|
|
24
|
-
*/
|
|
25
|
-
var PackageChangeKind;
|
|
26
|
-
(function (PackageChangeKind) {
|
|
27
|
-
/**
|
|
28
|
-
* Indicates that a package was added.
|
|
29
|
-
*/
|
|
30
|
-
PackageChangeKind["add"] = "add";
|
|
31
|
-
/**
|
|
32
|
-
* Indicates that a package was removed.
|
|
33
|
-
*/
|
|
34
|
-
PackageChangeKind["remove"] = "remove";
|
|
35
|
-
})(PackageChangeKind || (exports.PackageChangeKind = PackageChangeKind = {}));
|
|
36
|
-
/**
|
|
37
|
-
* Error thrown when a package manager cannot list available package versions.
|
|
38
|
-
*
|
|
39
|
-
* This distinguishes an *unsupported capability* from an *operational failure* (such as a
|
|
40
|
-
* failed command, a network error, or malformed/unparseable output). Consumers of
|
|
41
|
-
* {@link PythonPackageGetterApi.getPackageAvailableVersions} should treat this specific error
|
|
42
|
-
* as a signal to fall back to manual version entry, while letting any other error propagate.
|
|
43
|
-
*
|
|
44
|
-
* The {@link code} property carries a stable, string-literal discriminator so the error can be
|
|
45
|
-
* recognized reliably across extension bundle boundaries, where `instanceof` may fail because
|
|
46
|
-
* each bundle can load its own copy of this class. Prefer {@link isPackageVersionLookupNotSupportedError}
|
|
47
|
-
* over a bare `instanceof` check for that reason.
|
|
48
|
-
*/
|
|
49
|
-
class PackageVersionLookupNotSupportedError extends Error {
|
|
50
|
-
constructor(message) {
|
|
51
|
-
super(message ?? 'The package manager does not support looking up available package versions.');
|
|
52
|
-
/**
|
|
53
|
-
* Stable discriminator identifying this error type across bundle boundaries.
|
|
54
|
-
*/
|
|
55
|
-
this.code = 'PackageVersionLookupNotSupported';
|
|
56
|
-
this.name = 'PackageVersionLookupNotSupportedError';
|
|
57
|
-
// Preserve the prototype chain when this class is transpiled to older targets so that
|
|
58
|
-
// `instanceof` continues to work within a single bundle.
|
|
59
|
-
Object.setPrototypeOf(this, PackageVersionLookupNotSupportedError.prototype);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.PackageVersionLookupNotSupportedError = PackageVersionLookupNotSupportedError;
|
|
63
|
-
/**
|
|
64
|
-
* Type guard reporting whether an error represents unsupported package version lookup.
|
|
65
|
-
*
|
|
66
|
-
* Uses the stable {@link PackageVersionLookupNotSupportedError.code} discriminator, so it returns
|
|
67
|
-
* `true` even when the error crossed an extension bundle boundary and `instanceof` would fail.
|
|
21
|
+
/*
|
|
22
|
+
* Do not introduce any breaking changes to this API.
|
|
23
|
+
* This is the public API for other extensions to interact with the Python Environments extension.
|
|
68
24
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
25
|
+
* This module is a small public runtime/package facade: it re-exports all public type contracts
|
|
26
|
+
* from `./types` and the concrete error/guard from `./publicErrors`, and hosts the runtime surface
|
|
27
|
+
* (`EXTENSION_ID` and `PythonEnvironments.api()`).
|
|
72
28
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
(typeof error === 'object' &&
|
|
76
|
-
error !== null &&
|
|
77
|
-
'code' in error &&
|
|
78
|
-
error.code === 'PackageVersionLookupNotSupported'));
|
|
79
|
-
}
|
|
29
|
+
__exportStar(require("./types.js"), exports);
|
|
30
|
+
__exportStar(require("./publicErrors.js"), exports);
|
|
80
31
|
exports.EXTENSION_ID = 'ms-python.vscode-python-envs';
|
|
81
32
|
var PythonEnvironments;
|
|
82
33
|
(function (PythonEnvironments) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.PackageVersionLookupNotSupportedError = void 0;
|
|
6
|
+
exports.isPackageVersionLookupNotSupportedError = isPackageVersionLookupNotSupportedError;
|
|
7
|
+
/*
|
|
8
|
+
* Concrete, public runtime error type(s) for the Python Environments API.
|
|
9
|
+
* Kept separate from `./types.ts` (pure contracts) and re-exported from `./api.ts` to keep
|
|
10
|
+
* that facade small.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Error thrown when a package manager cannot list available package versions.
|
|
14
|
+
*
|
|
15
|
+
* This distinguishes an *unsupported capability* from an *operational failure* (such as a
|
|
16
|
+
* failed command, a network error, or malformed/unparseable output). Consumers of
|
|
17
|
+
* {@link PythonPackageGetterApi.getPackageAvailableVersions} should treat this specific error
|
|
18
|
+
* as a signal to fall back to manual version entry, while letting any other error propagate.
|
|
19
|
+
*
|
|
20
|
+
* The {@link code} property carries a stable, string-literal discriminator so the error can be
|
|
21
|
+
* recognized reliably across extension bundle boundaries, where `instanceof` may fail because
|
|
22
|
+
* each bundle can load its own copy of this class. Prefer {@link isPackageVersionLookupNotSupportedError}
|
|
23
|
+
* over a bare `instanceof` check for that reason.
|
|
24
|
+
*/
|
|
25
|
+
class PackageVersionLookupNotSupportedError extends Error {
|
|
26
|
+
constructor(message) {
|
|
27
|
+
super(message ?? 'The package manager does not support looking up available package versions.');
|
|
28
|
+
/**
|
|
29
|
+
* Stable discriminator identifying this error type across bundle boundaries.
|
|
30
|
+
*/
|
|
31
|
+
this.code = 'PackageVersionLookupNotSupported';
|
|
32
|
+
this.name = 'PackageVersionLookupNotSupportedError';
|
|
33
|
+
// Preserve the prototype chain when this class is transpiled to older targets so that
|
|
34
|
+
// `instanceof` continues to work within a single bundle.
|
|
35
|
+
Object.setPrototypeOf(this, PackageVersionLookupNotSupportedError.prototype);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.PackageVersionLookupNotSupportedError = PackageVersionLookupNotSupportedError;
|
|
39
|
+
/**
|
|
40
|
+
* Type guard reporting whether an error represents unsupported package version lookup.
|
|
41
|
+
*
|
|
42
|
+
* Uses the stable {@link PackageVersionLookupNotSupportedError.code} discriminator, so it returns
|
|
43
|
+
* `true` even when the error crossed an extension bundle boundary and `instanceof` would fail.
|
|
44
|
+
*
|
|
45
|
+
* @param error The value to test.
|
|
46
|
+
* @returns `true` if `error` is a {@link PackageVersionLookupNotSupportedError} (or a structurally
|
|
47
|
+
* equivalent error carrying the same `code`).
|
|
48
|
+
*/
|
|
49
|
+
function isPackageVersionLookupNotSupportedError(error) {
|
|
50
|
+
return (error instanceof PackageVersionLookupNotSupportedError ||
|
|
51
|
+
(typeof error === 'object' &&
|
|
52
|
+
error !== null &&
|
|
53
|
+
'code' in error &&
|
|
54
|
+
error.code === 'PackageVersionLookupNotSupported'));
|
|
55
|
+
}
|
package/out/cjs/types.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.PackageChangeKind = exports.EnvironmentChangeKind = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Enum representing the kinds of environment changes.
|
|
8
|
+
*/
|
|
9
|
+
var EnvironmentChangeKind;
|
|
10
|
+
(function (EnvironmentChangeKind) {
|
|
11
|
+
/**
|
|
12
|
+
* Indicates that an environment was added.
|
|
13
|
+
*/
|
|
14
|
+
EnvironmentChangeKind["add"] = "add";
|
|
15
|
+
/**
|
|
16
|
+
* Indicates that an environment was removed.
|
|
17
|
+
*/
|
|
18
|
+
EnvironmentChangeKind["remove"] = "remove";
|
|
19
|
+
})(EnvironmentChangeKind || (exports.EnvironmentChangeKind = EnvironmentChangeKind = {}));
|
|
20
|
+
/**
|
|
21
|
+
* Enum representing the kinds of package changes.
|
|
22
|
+
*/
|
|
23
|
+
var PackageChangeKind;
|
|
24
|
+
(function (PackageChangeKind) {
|
|
25
|
+
/**
|
|
26
|
+
* Indicates that a package was added.
|
|
27
|
+
*/
|
|
28
|
+
PackageChangeKind["add"] = "add";
|
|
29
|
+
/**
|
|
30
|
+
* Indicates that a package was removed.
|
|
31
|
+
*/
|
|
32
|
+
PackageChangeKind["remove"] = "remove";
|
|
33
|
+
})(PackageChangeKind || (exports.PackageChangeKind = PackageChangeKind = {}));
|
package/out/esm/main.mjs
CHANGED
|
@@ -1,77 +1,16 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { extensions } from 'vscode';
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
export var EnvironmentChangeKind;
|
|
8
|
-
(function (EnvironmentChangeKind) {
|
|
9
|
-
/**
|
|
10
|
-
* Indicates that an environment was added.
|
|
11
|
-
*/
|
|
12
|
-
EnvironmentChangeKind["add"] = "add";
|
|
13
|
-
/**
|
|
14
|
-
* Indicates that an environment was removed.
|
|
15
|
-
*/
|
|
16
|
-
EnvironmentChangeKind["remove"] = "remove";
|
|
17
|
-
})(EnvironmentChangeKind || (EnvironmentChangeKind = {}));
|
|
18
|
-
/**
|
|
19
|
-
* Enum representing the kinds of package changes.
|
|
20
|
-
*/
|
|
21
|
-
export var PackageChangeKind;
|
|
22
|
-
(function (PackageChangeKind) {
|
|
23
|
-
/**
|
|
24
|
-
* Indicates that a package was added.
|
|
25
|
-
*/
|
|
26
|
-
PackageChangeKind["add"] = "add";
|
|
27
|
-
/**
|
|
28
|
-
* Indicates that a package was removed.
|
|
29
|
-
*/
|
|
30
|
-
PackageChangeKind["remove"] = "remove";
|
|
31
|
-
})(PackageChangeKind || (PackageChangeKind = {}));
|
|
32
|
-
/**
|
|
33
|
-
* Error thrown when a package manager cannot list available package versions.
|
|
34
|
-
*
|
|
35
|
-
* This distinguishes an *unsupported capability* from an *operational failure* (such as a
|
|
36
|
-
* failed command, a network error, or malformed/unparseable output). Consumers of
|
|
37
|
-
* {@link PythonPackageGetterApi.getPackageAvailableVersions} should treat this specific error
|
|
38
|
-
* as a signal to fall back to manual version entry, while letting any other error propagate.
|
|
39
|
-
*
|
|
40
|
-
* The {@link code} property carries a stable, string-literal discriminator so the error can be
|
|
41
|
-
* recognized reliably across extension bundle boundaries, where `instanceof` may fail because
|
|
42
|
-
* each bundle can load its own copy of this class. Prefer {@link isPackageVersionLookupNotSupportedError}
|
|
43
|
-
* over a bare `instanceof` check for that reason.
|
|
44
|
-
*/
|
|
45
|
-
export class PackageVersionLookupNotSupportedError extends Error {
|
|
46
|
-
constructor(message) {
|
|
47
|
-
super(message ?? 'The package manager does not support looking up available package versions.');
|
|
48
|
-
/**
|
|
49
|
-
* Stable discriminator identifying this error type across bundle boundaries.
|
|
50
|
-
*/
|
|
51
|
-
this.code = 'PackageVersionLookupNotSupported';
|
|
52
|
-
this.name = 'PackageVersionLookupNotSupportedError';
|
|
53
|
-
// Preserve the prototype chain when this class is transpiled to older targets so that
|
|
54
|
-
// `instanceof` continues to work within a single bundle.
|
|
55
|
-
Object.setPrototypeOf(this, PackageVersionLookupNotSupportedError.prototype);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Type guard reporting whether an error represents unsupported package version lookup.
|
|
60
|
-
*
|
|
61
|
-
* Uses the stable {@link PackageVersionLookupNotSupportedError.code} discriminator, so it returns
|
|
62
|
-
* `true` even when the error crossed an extension bundle boundary and `instanceof` would fail.
|
|
4
|
+
/*
|
|
5
|
+
* Do not introduce any breaking changes to this API.
|
|
6
|
+
* This is the public API for other extensions to interact with the Python Environments extension.
|
|
63
7
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
8
|
+
* This module is a small public runtime/package facade: it re-exports all public type contracts
|
|
9
|
+
* from `./types` and the concrete error/guard from `./publicErrors`, and hosts the runtime surface
|
|
10
|
+
* (`EXTENSION_ID` and `PythonEnvironments.api()`).
|
|
67
11
|
*/
|
|
68
|
-
export
|
|
69
|
-
|
|
70
|
-
(typeof error === 'object' &&
|
|
71
|
-
error !== null &&
|
|
72
|
-
'code' in error &&
|
|
73
|
-
error.code === 'PackageVersionLookupNotSupported'));
|
|
74
|
-
}
|
|
12
|
+
export * from './types.js';
|
|
13
|
+
export * from './publicErrors.js';
|
|
75
14
|
export const EXTENSION_ID = 'ms-python.vscode-python-envs';
|
|
76
15
|
export var PythonEnvironments;
|
|
77
16
|
(function (PythonEnvironments) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/*
|
|
4
|
+
* Concrete, public runtime error type(s) for the Python Environments API.
|
|
5
|
+
* Kept separate from `./types.ts` (pure contracts) and re-exported from `./api.ts` to keep
|
|
6
|
+
* that facade small.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when a package manager cannot list available package versions.
|
|
10
|
+
*
|
|
11
|
+
* This distinguishes an *unsupported capability* from an *operational failure* (such as a
|
|
12
|
+
* failed command, a network error, or malformed/unparseable output). Consumers of
|
|
13
|
+
* {@link PythonPackageGetterApi.getPackageAvailableVersions} should treat this specific error
|
|
14
|
+
* as a signal to fall back to manual version entry, while letting any other error propagate.
|
|
15
|
+
*
|
|
16
|
+
* The {@link code} property carries a stable, string-literal discriminator so the error can be
|
|
17
|
+
* recognized reliably across extension bundle boundaries, where `instanceof` may fail because
|
|
18
|
+
* each bundle can load its own copy of this class. Prefer {@link isPackageVersionLookupNotSupportedError}
|
|
19
|
+
* over a bare `instanceof` check for that reason.
|
|
20
|
+
*/
|
|
21
|
+
export class PackageVersionLookupNotSupportedError extends Error {
|
|
22
|
+
constructor(message) {
|
|
23
|
+
super(message ?? 'The package manager does not support looking up available package versions.');
|
|
24
|
+
/**
|
|
25
|
+
* Stable discriminator identifying this error type across bundle boundaries.
|
|
26
|
+
*/
|
|
27
|
+
this.code = 'PackageVersionLookupNotSupported';
|
|
28
|
+
this.name = 'PackageVersionLookupNotSupportedError';
|
|
29
|
+
// Preserve the prototype chain when this class is transpiled to older targets so that
|
|
30
|
+
// `instanceof` continues to work within a single bundle.
|
|
31
|
+
Object.setPrototypeOf(this, PackageVersionLookupNotSupportedError.prototype);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Type guard reporting whether an error represents unsupported package version lookup.
|
|
36
|
+
*
|
|
37
|
+
* Uses the stable {@link PackageVersionLookupNotSupportedError.code} discriminator, so it returns
|
|
38
|
+
* `true` even when the error crossed an extension bundle boundary and `instanceof` would fail.
|
|
39
|
+
*
|
|
40
|
+
* @param error The value to test.
|
|
41
|
+
* @returns `true` if `error` is a {@link PackageVersionLookupNotSupportedError} (or a structurally
|
|
42
|
+
* equivalent error carrying the same `code`).
|
|
43
|
+
*/
|
|
44
|
+
export function isPackageVersionLookupNotSupportedError(error) {
|
|
45
|
+
return (error instanceof PackageVersionLookupNotSupportedError ||
|
|
46
|
+
(typeof error === 'object' &&
|
|
47
|
+
error !== null &&
|
|
48
|
+
'code' in error &&
|
|
49
|
+
error.code === 'PackageVersionLookupNotSupported'));
|
|
50
|
+
}
|
package/out/esm/types.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the kinds of environment changes.
|
|
5
|
+
*/
|
|
6
|
+
export var EnvironmentChangeKind;
|
|
7
|
+
(function (EnvironmentChangeKind) {
|
|
8
|
+
/**
|
|
9
|
+
* Indicates that an environment was added.
|
|
10
|
+
*/
|
|
11
|
+
EnvironmentChangeKind["add"] = "add";
|
|
12
|
+
/**
|
|
13
|
+
* Indicates that an environment was removed.
|
|
14
|
+
*/
|
|
15
|
+
EnvironmentChangeKind["remove"] = "remove";
|
|
16
|
+
})(EnvironmentChangeKind || (EnvironmentChangeKind = {}));
|
|
17
|
+
/**
|
|
18
|
+
* Enum representing the kinds of package changes.
|
|
19
|
+
*/
|
|
20
|
+
export var PackageChangeKind;
|
|
21
|
+
(function (PackageChangeKind) {
|
|
22
|
+
/**
|
|
23
|
+
* Indicates that a package was added.
|
|
24
|
+
*/
|
|
25
|
+
PackageChangeKind["add"] = "add";
|
|
26
|
+
/**
|
|
27
|
+
* Indicates that a package was removed.
|
|
28
|
+
*/
|
|
29
|
+
PackageChangeKind["remove"] = "remove";
|
|
30
|
+
})(PackageChangeKind || (PackageChangeKind = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PythonEnvironmentApi } from './types.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './publicErrors.js';
|
|
4
|
+
export declare const EXTENSION_ID = "ms-python.vscode-python-envs";
|
|
5
|
+
export declare namespace PythonEnvironments {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the API exposed by the Python Environments extension in VS Code.
|
|
8
|
+
*/
|
|
9
|
+
function api(): Promise<PythonEnvironmentApi>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a package manager cannot list available package versions.
|
|
3
|
+
*
|
|
4
|
+
* This distinguishes an *unsupported capability* from an *operational failure* (such as a
|
|
5
|
+
* failed command, a network error, or malformed/unparseable output). Consumers of
|
|
6
|
+
* {@link PythonPackageGetterApi.getPackageAvailableVersions} should treat this specific error
|
|
7
|
+
* as a signal to fall back to manual version entry, while letting any other error propagate.
|
|
8
|
+
*
|
|
9
|
+
* The {@link code} property carries a stable, string-literal discriminator so the error can be
|
|
10
|
+
* recognized reliably across extension bundle boundaries, where `instanceof` may fail because
|
|
11
|
+
* each bundle can load its own copy of this class. Prefer {@link isPackageVersionLookupNotSupportedError}
|
|
12
|
+
* over a bare `instanceof` check for that reason.
|
|
13
|
+
*/
|
|
14
|
+
export declare class PackageVersionLookupNotSupportedError extends Error {
|
|
15
|
+
/**
|
|
16
|
+
* Stable discriminator identifying this error type across bundle boundaries.
|
|
17
|
+
*/
|
|
18
|
+
readonly code = "PackageVersionLookupNotSupported";
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Type guard reporting whether an error represents unsupported package version lookup.
|
|
23
|
+
*
|
|
24
|
+
* Uses the stable {@link PackageVersionLookupNotSupportedError.code} discriminator, so it returns
|
|
25
|
+
* `true` even when the error crossed an extension bundle boundary and `instanceof` would fail.
|
|
26
|
+
*
|
|
27
|
+
* @param error The value to test.
|
|
28
|
+
* @returns `true` if `error` is a {@link PackageVersionLookupNotSupportedError} (or a structurally
|
|
29
|
+
* equivalent error carrying the same `code`).
|
|
30
|
+
*/
|
|
31
|
+
export declare function isPackageVersionLookupNotSupportedError(error: unknown): error is PackageVersionLookupNotSupportedError;
|
|
@@ -414,24 +414,21 @@ export interface EnvironmentManager {
|
|
|
414
414
|
*/
|
|
415
415
|
onDidChangeEnvironment?: Event<DidChangeEnvironmentEventArgs>;
|
|
416
416
|
/**
|
|
417
|
-
* Resolves the
|
|
417
|
+
* Resolves the Python environment associated with the specified URI context.
|
|
418
418
|
*
|
|
419
|
-
* This method is used to obtain a fully detailed {@link PythonEnvironment} object. The input
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* - A folder that contains the Python environment.
|
|
423
|
-
* - The path to a Python executable.
|
|
419
|
+
* This method is used to obtain a fully detailed {@link PythonEnvironment} object. The input
|
|
420
|
+
* URI typically represents either a folder that contains the Python environment or the path to
|
|
421
|
+
* a Python executable.
|
|
424
422
|
*
|
|
425
|
-
* @param context - The context for resolving the environment
|
|
423
|
+
* @param context - The URI context for resolving the environment.
|
|
426
424
|
* @returns A promise that resolves to the fully detailed {@link PythonEnvironment}, or `undefined` if the environment cannot be resolved.
|
|
427
425
|
*
|
|
428
426
|
* @remarks
|
|
429
|
-
* Called to turn a
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
* launching Python.
|
|
427
|
+
* Called to turn a {@link Uri} pointing at an interpreter or environment folder into a
|
|
428
|
+
* fully-populated {@link PythonEnvironment} with complete {@link PythonEnvironment.execInfo}.
|
|
429
|
+
* Typical triggers include the user manually selecting an interpreter path, resolving
|
|
430
|
+
* `python.defaultInterpreterPath` at startup, and populating execution details before launching
|
|
431
|
+
* Python.
|
|
435
432
|
*/
|
|
436
433
|
resolve(context: ResolveEnvironmentContext): Promise<PythonEnvironment | undefined>;
|
|
437
434
|
/**
|
|
@@ -915,10 +912,10 @@ export interface PythonEnvironmentsApi {
|
|
|
915
912
|
*/
|
|
916
913
|
onDidChangeEnvironments: Event<DidChangeEnvironmentsEventArgs>;
|
|
917
914
|
/**
|
|
918
|
-
* This method is used to get the details
|
|
919
|
-
*
|
|
915
|
+
* This method is used to get the details for the Python environment associated with a URI
|
|
916
|
+
* context, such as an interpreter path or environment folder.
|
|
920
917
|
*
|
|
921
|
-
* @param context
|
|
918
|
+
* @param context - The URI context for which environment details are required.
|
|
922
919
|
*/
|
|
923
920
|
resolveEnvironment(context: ResolveEnvironmentContext): Promise<PythonEnvironment | undefined>;
|
|
924
921
|
}
|
|
@@ -958,37 +955,6 @@ export interface PythonPackageManagerRegistrationApi {
|
|
|
958
955
|
extensionId?: string;
|
|
959
956
|
}): Disposable;
|
|
960
957
|
}
|
|
961
|
-
/**
|
|
962
|
-
* Error thrown when a package manager cannot list available package versions.
|
|
963
|
-
*
|
|
964
|
-
* This distinguishes an *unsupported capability* from an *operational failure* (such as a
|
|
965
|
-
* failed command, a network error, or malformed/unparseable output). Consumers of
|
|
966
|
-
* {@link PythonPackageGetterApi.getPackageAvailableVersions} should treat this specific error
|
|
967
|
-
* as a signal to fall back to manual version entry, while letting any other error propagate.
|
|
968
|
-
*
|
|
969
|
-
* The {@link code} property carries a stable, string-literal discriminator so the error can be
|
|
970
|
-
* recognized reliably across extension bundle boundaries, where `instanceof` may fail because
|
|
971
|
-
* each bundle can load its own copy of this class. Prefer {@link isPackageVersionLookupNotSupportedError}
|
|
972
|
-
* over a bare `instanceof` check for that reason.
|
|
973
|
-
*/
|
|
974
|
-
export declare class PackageVersionLookupNotSupportedError extends Error {
|
|
975
|
-
/**
|
|
976
|
-
* Stable discriminator identifying this error type across bundle boundaries.
|
|
977
|
-
*/
|
|
978
|
-
readonly code = "PackageVersionLookupNotSupported";
|
|
979
|
-
constructor(message?: string);
|
|
980
|
-
}
|
|
981
|
-
/**
|
|
982
|
-
* Type guard reporting whether an error represents unsupported package version lookup.
|
|
983
|
-
*
|
|
984
|
-
* Uses the stable {@link PackageVersionLookupNotSupportedError.code} discriminator, so it returns
|
|
985
|
-
* `true` even when the error crossed an extension bundle boundary and `instanceof` would fail.
|
|
986
|
-
*
|
|
987
|
-
* @param error The value to test.
|
|
988
|
-
* @returns `true` if `error` is a {@link PackageVersionLookupNotSupportedError} (or a structurally
|
|
989
|
-
* equivalent error carrying the same `code`).
|
|
990
|
-
*/
|
|
991
|
-
export declare function isPackageVersionLookupNotSupportedError(error: unknown): error is PackageVersionLookupNotSupportedError;
|
|
992
958
|
/**
|
|
993
959
|
* Controls how package version lookup failures are reported.
|
|
994
960
|
*/
|
|
@@ -1243,7 +1209,9 @@ export interface PythonBackgroundRunOptions {
|
|
|
1243
1209
|
*/
|
|
1244
1210
|
args: string[];
|
|
1245
1211
|
/**
|
|
1246
|
-
* Current working directory for the script or module.
|
|
1212
|
+
* Current working directory for the script or module. This is passed directly to the spawned
|
|
1213
|
+
* process; when it is omitted the process inherits the extension host's working directory,
|
|
1214
|
+
* which is not the project directory. Supply this when the script resolves relative paths.
|
|
1247
1215
|
*/
|
|
1248
1216
|
cwd?: string;
|
|
1249
1217
|
/**
|
|
@@ -1307,10 +1275,3 @@ export interface PythonEnvironmentVariablesApi {
|
|
|
1307
1275
|
*/
|
|
1308
1276
|
export interface PythonEnvironmentApi extends PythonEnvironmentManagerApi, PythonPackageManagerApi, PythonProjectApi, PythonExecutionApi, PythonEnvironmentVariablesApi {
|
|
1309
1277
|
}
|
|
1310
|
-
export declare const EXTENSION_ID = "ms-python.vscode-python-envs";
|
|
1311
|
-
export declare namespace PythonEnvironments {
|
|
1312
|
-
/**
|
|
1313
|
-
* Returns the API exposed by the Python Environments extension in VS Code.
|
|
1314
|
-
*/
|
|
1315
|
-
function api(): Promise<PythonEnvironmentApi>;
|
|
1316
|
-
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/python-environments",
|
|
3
3
|
"description": "An API facade for the Python Environments extension in VS Code",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft Corporation"
|
|
7
7
|
},
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"Environments"
|
|
13
13
|
],
|
|
14
14
|
"main": "./out/cjs/main.cjs",
|
|
15
|
-
"types": "./out/
|
|
15
|
+
"types": "./out/types/main.d.ts",
|
|
16
16
|
"exports": {
|
|
17
17
|
"import": {
|
|
18
|
-
"types": "./out/
|
|
18
|
+
"types": "./out/types/main.d.ts",
|
|
19
19
|
"default": "./out/esm/main.mjs"
|
|
20
20
|
},
|
|
21
21
|
"require": {
|
|
22
|
-
"types": "./out/
|
|
22
|
+
"types": "./out/types/main.d.ts",
|
|
23
23
|
"default": "./out/cjs/main.cjs"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -39,11 +39,14 @@
|
|
|
39
39
|
"scripts": {
|
|
40
40
|
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node -e \"process.exitCode = 1\"",
|
|
41
41
|
"prepack": "npm run all:publish",
|
|
42
|
-
"all:publish": "git clean -xfd . && npm install && npm run compile",
|
|
43
|
-
"
|
|
44
|
-
"compile
|
|
42
|
+
"all:publish": "git clean -xfd . && npm install && npm run copy:sources && npm run compile",
|
|
43
|
+
"copy:sources": "node ./scripts/copy-sources.cjs",
|
|
44
|
+
"compile": "npm run clean && npm run compile:types && npm run compile:esm && npm run compile:cjs",
|
|
45
|
+
"compile:types": "tsc -b ./tsconfig.types.json",
|
|
46
|
+
"compile:esm": "tsc -b ./tsconfig.esm.json && mve out/esm/main.js out/esm/main.mjs && node -e \"require('fs').writeFileSync('out/esm/package.json', '{\\\"type\\\":\\\"module\\\"}')\"",
|
|
45
47
|
"compile:cjs": "tsc -b ./tsconfig.cjs.json && mve out/cjs/main.js out/cjs/main.cjs",
|
|
46
48
|
"clean": "node -e \"const fs = require('fs'); fs.rmSync('./out', { recursive: true, force: true });\"",
|
|
49
|
+
"test": "npm run test:package",
|
|
47
50
|
"test:package": "node ./scripts/test-package.cjs"
|
|
48
51
|
},
|
|
49
52
|
"devDependencies": {
|