Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dist
node_modules
.vscode-test/
*.vsix
*.tsbuildinfo
.nox/
.venv/
**/__pycache__/
Expand Down
53 changes: 53 additions & 0 deletions build/azure-pipeline.npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: $(Date:yyyyMMdd)$(Rev:.r)

trigger: none
pr: none

resources:
repositories:
- repository: templates
type: github
name: microsoft/vscode-engineering
ref: main
endpoint: Monaco

parameters:
- name: quality
displayName: Quality
type: string
default: latest
values:
- latest
- next
- name: publishPythonEnvsApi
displayName: 🚀 Publish @vscode/python-environments
type: boolean
default: false

extends:
template: azure-pipelines/npm-package/pipeline.yml@templates
parameters:
npmPackages:
- name: pythonEnvironmentsApi
testPlatforms:
- name: Linux
nodeVersions:
- 22.21.1
- name: MacOS
nodeVersions:
- 22.21.1
- name: Windows
nodeVersions:
- 22.21.1
testSteps:
- template: /build/templates/test-steps.yml@self
parameters:
package: pythonEnvironmentsApi
buildSteps:
- template: /build/templates/pack-steps.yml@self
parameters:
package: pythonEnvironmentsApi
ghTagPrefix: release/pythonEnvironmentsApi/
tag: ${{ parameters.quality }}
publishPackage: ${{ parameters.publishPythonEnvsApi }}
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
7 changes: 7 additions & 0 deletions build/templates/pack-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
- name: package

steps:
- script: npm install
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.package }}
displayName: Install package dependencies
19 changes: 19 additions & 0 deletions build/templates/test-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
parameters:
- name: package
type: string
- name: script
type: string
default: 'all:publish'

steps:
- script: npm install
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.package }}
displayName: Install package dependencies
- bash: |
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
echo ">>> Started xvfb"
displayName: Start xvfb
condition: eq(variables['Agent.OS'], 'Linux')
- script: npm run ${{ parameters.script }}
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.package }}
displayName: Verify package
5 changes: 5 additions & 0 deletions pythonEnvironmentsApi/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
src/
out/**/*.map
*.tsbuildinfo
tsconfig*.json
21 changes: 21 additions & 0 deletions pythonEnvironmentsApi/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation. All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 37 additions & 0 deletions pythonEnvironmentsApi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# @vscode/python-environments

This package provides type declarations and a helper to access the API exposed by the [Python Environments](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs) extension for VS Code.

## Usage

1. Install the package and add an `extensionDependencies` entry in your extension's `package.json`:

```jsonc
// package.json
{
"extensionDependencies": ["ms-python.vscode-python-envs"]
}
```

2. Install the npm package:

```
npm install @vscode/python-environments
```

3. Import and use the API in your extension:

```typescript
import { PythonEnvironments } from '@vscode/python-environments';

export async function activate() {
const api = await PythonEnvironments.api();

// Get all discovered environments
const envs = await api.getEnvironments('all');
for (const env of envs) {
console.log(env.displayName, env.version);
}
}
```

41 changes: 41 additions & 0 deletions pythonEnvironmentsApi/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>) of a security vulnerability, please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).

If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
- Full paths of source file(s) related to the manifestation of the issue
- The location of the affected source code (tag/branch/commit or direct URL)
- Any special configuration required to reproduce the issue
- Step-by-step instructions to reproduce the issue
- Proof-of-concept or exploit code (if possible)
- Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
42 changes: 42 additions & 0 deletions pythonEnvironmentsApi/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions pythonEnvironmentsApi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@vscode/python-environments",
"description": "An API facade for the Python Environments extension in VS Code",
"version": "1.0.0",
"author": {
"name": "Microsoft Corporation"
},
"keywords": [
"Python",
"VSCode",
"API",
"Environments"
],
"main": "./out/main.js",
"types": "./out/main.d.ts",
"engines": {
"node": ">=22.21.1",
"vscode": "^1.110.0"
},
"license": "MIT",
"homepage": "https://github.com/microsoft/vscode-python-environments/tree/main/pythonEnvironmentsApi",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode-python-environments"
},
"bugs": {
"url": "https://github.com/microsoft/vscode-python-environments/issues"
},
"scripts": {
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node -e \"process.exitCode = 1\"",
"prepack": "npm run all:publish",
"all:publish": "git clean -xfd . && npm install && npm run compile",
"compile": "tsc -b ./tsconfig.json",
"clean": "node -e \"const fs = require('fs'); fs.rmSync('./out', { recursive: true, force: true });\""
},
"devDependencies": {
"@types/vscode": "^1.99.0",
"typescript": "^5.1.3"
}
}
Loading
Loading