Skip to content

Commit 23e4283

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/multi-b3740a5222
2 parents 452f42f + d9cd364 commit 23e4283

File tree

17 files changed

+2134
-14
lines changed

17 files changed

+2134
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dist
33
node_modules
44
.vscode-test/
55
*.vsix
6+
*.tsbuildinfo
67
.nox/
78
.venv/
89
**/__pycache__/

build/azure-pipeline.npm.yml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: $(Date:yyyyMMdd)$(Rev:.r)
2+
3+
trigger: none
4+
pr: none
5+
6+
resources:
7+
repositories:
8+
- repository: MicroBuildTemplate
9+
type: git
10+
name: 1ESPipelineTemplates/MicroBuildTemplate
11+
ref: refs/tags/release
12+
13+
parameters:
14+
- name: quality
15+
displayName: 📦 Release Quality
16+
type: string
17+
default: stable
18+
values:
19+
- stable
20+
- preview
21+
22+
- name: publishPackage
23+
displayName: 🚀 Publish to npm
24+
type: boolean
25+
default: false
26+
27+
- name: buildSteps
28+
type: stepList
29+
default:
30+
- task: NodeTool@0
31+
inputs:
32+
versionSpec: '22.21.1'
33+
displayName: Select Node version
34+
35+
- script: npm install
36+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
37+
displayName: Install package dependencies
38+
39+
- script: npm run compile
40+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
41+
displayName: Compile TypeScript
42+
43+
- script: npm pack --ignore-scripts
44+
workingDirectory: $(Build.SourcesDirectory)/pythonEnvironmentsApi
45+
displayName: Pack npm package
46+
47+
variables:
48+
- name: TeamName
49+
value: vscode-python-environments
50+
- name: PackageName
51+
value: '@vscode/python-environments'
52+
- name: PackageDir
53+
value: pythonEnvironmentsApi
54+
- name: npmTag
55+
${{ if eq(parameters.quality, 'preview') }}:
56+
value: next
57+
${{ else }}:
58+
value: latest
59+
- name: AzureArtifactsFeedUrl
60+
value: 'https://pkgs.dev.azure.com/azure-public/vside/_packaging/python-environments/npm/registry/'
61+
# Same URL without the https:// prefix (used in .npmrc auth lines)
62+
- name: AzureArtifactsFeedUrlNoProtocol
63+
value: 'pkgs.dev.azure.com/azure-public/vside/_packaging/python-environments/npm/registry/'
64+
# Managed Identity service connection for Azure Artifacts auth (shared with Pylance)
65+
- name: AzureServiceConnection
66+
value: 'PylanceSecureVsIdePublishWithManagedIdentity'
67+
68+
extends:
69+
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
70+
parameters:
71+
sdl:
72+
sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES
73+
codeSignValidation:
74+
enabled: true
75+
sbom:
76+
enabled: true
77+
pool:
78+
name: AzurePipelines-EO
79+
image: 1ESPT-Ubuntu22.04
80+
os: linux
81+
82+
customBuildTags:
83+
- ES365AIMigrationTooling
84+
85+
stages:
86+
- stage: Build
87+
displayName: Build & Pack
88+
jobs:
89+
- job: BuildPackage
90+
displayName: Build npm package
91+
templateContext:
92+
outputs:
93+
- output: pipelineArtifact
94+
targetPath: $(Build.ArtifactStagingDirectory)
95+
artifactName: npm-package
96+
steps:
97+
- ${{ each step in parameters.buildSteps }}:
98+
- ${{ step }}
99+
100+
- task: CopyFiles@2
101+
displayName: Copy package tarball to staging
102+
inputs:
103+
sourceFolder: $(Build.SourcesDirectory)/pythonEnvironmentsApi
104+
contents: '*.tgz'
105+
targetFolder: $(Build.ArtifactStagingDirectory)
106+
107+
- stage: Publish
108+
displayName: Publish to Azure Artifacts
109+
dependsOn: Build
110+
condition: and(succeeded(), eq('${{ parameters.publishPackage }}', 'true'))
111+
jobs:
112+
- job: PublishPackage
113+
displayName: Publish $(PackageName)
114+
templateContext:
115+
type: releaseJob
116+
isProduction: true
117+
inputs:
118+
- input: pipelineArtifact
119+
artifactName: npm-package
120+
targetPath: $(Pipeline.Workspace)/npm-package
121+
steps:
122+
- checkout: none
123+
124+
- task: NodeTool@0
125+
inputs:
126+
versionSpec: '22.21.1'
127+
displayName: Select Node version
128+
129+
# Acquire a short-lived AAD token via Managed Identity (no stored secrets)
130+
# SEE https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance
131+
- task: AzureCLI@2
132+
displayName: Acquire AAD token via Managed Identity
133+
inputs:
134+
azureSubscription: '$(AzureServiceConnection)'
135+
scriptType: 'pscore'
136+
scriptLocation: 'inlineScript'
137+
inlineScript: |
138+
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
139+
Write-Host "##vso[task.setvariable variable=AzdoToken;issecret=true]$token"
140+
141+
- powershell: |
142+
@"
143+
registry=$(AzureArtifactsFeedUrl)
144+
always-auth=true
145+
"@ | Out-File -FilePath .npmrc
146+
147+
@"
148+
; begin auth token
149+
//$(AzureArtifactsFeedUrlNoProtocol):username=VssSessionToken
150+
//$(AzureArtifactsFeedUrlNoProtocol):_authToken=$env:AZDO_TOKEN
151+
//$(AzureArtifactsFeedUrlNoProtocol):email=not-used@example.com
152+
; end auth token
153+
"@ | Out-File -FilePath $HOME/.npmrc
154+
env:
155+
AZDO_TOKEN: $(AzdoToken)
156+
displayName: Create .npmrc files
157+
158+
- powershell: |
159+
$tgz = Get-ChildItem "$(Pipeline.Workspace)/npm-package/*.tgz" | Select-Object -First 1
160+
if (-not $tgz) {
161+
Write-Error "No .tgz file found in $(Pipeline.Workspace)/npm-package/"
162+
exit 1
163+
}
164+
Write-Host "Publishing: $($tgz.FullName)"
165+
if ("$(npmTag)" -eq "next") {
166+
npm publish $tgz.FullName --registry $(AzureArtifactsFeedUrl) --tag next --ignore-scripts
167+
} else {
168+
npm publish $tgz.FullName --registry $(AzureArtifactsFeedUrl) --ignore-scripts
169+
}
170+
displayName: npm publish (${{ parameters.quality }})

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.21.0",
5+
"version": "1.23.0",
66
"publisher": "ms-python",
77
"preview": true,
88
"engines": {

pythonEnvironmentsApi/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
src/
3+
out/**/*.map
4+
*.tsbuildinfo
5+
tsconfig*.json

pythonEnvironmentsApi/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation. All rights reserved.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

pythonEnvironmentsApi/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# @vscode/python-environments
2+
3+
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.
4+
5+
## Usage
6+
7+
1. Install the package and add an `extensionDependencies` entry in your extension's `package.json`:
8+
9+
```jsonc
10+
// package.json
11+
{
12+
"extensionDependencies": ["ms-python.vscode-python-envs"]
13+
}
14+
```
15+
16+
2. Install the npm package:
17+
18+
```
19+
npm install @vscode/python-environments
20+
```
21+
22+
3. Import and use the API in your extension:
23+
24+
```typescript
25+
import { PythonEnvironments } from '@vscode/python-environments';
26+
27+
export async function activate() {
28+
const api = await PythonEnvironments.api();
29+
30+
// Get all discovered environments
31+
const envs = await api.getEnvironments('all');
32+
for (const env of envs) {
33+
console.log(env.displayName, env.version);
34+
}
35+
}
36+
```
37+

pythonEnvironmentsApi/SECURITY.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->
2+
3+
## Security
4+
5+
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/).
6+
7+
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.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
14+
15+
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).
16+
17+
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).
18+
19+
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:
20+
21+
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
- Full paths of source file(s) related to the manifestation of the issue
23+
- The location of the affected source code (tag/branch/commit or direct URL)
24+
- Any special configuration required to reproduce the issue
25+
- Step-by-step instructions to reproduce the issue
26+
- Proof-of-concept or exploit code (if possible)
27+
- Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
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.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

pythonEnvironmentsApi/package-lock.json

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

pythonEnvironmentsApi/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "@vscode/python-environments",
3+
"description": "An API facade for the Python Environments extension in VS Code",
4+
"version": "1.0.0",
5+
"author": {
6+
"name": "Microsoft Corporation"
7+
},
8+
"keywords": [
9+
"Python",
10+
"VSCode",
11+
"API",
12+
"Environments"
13+
],
14+
"main": "./out/main.js",
15+
"types": "./out/main.d.ts",
16+
"engines": {
17+
"node": ">=22.21.1",
18+
"vscode": "^1.110.0"
19+
},
20+
"license": "MIT",
21+
"homepage": "https://github.com/microsoft/vscode-python-environments/tree/main/pythonEnvironmentsApi",
22+
"repository": {
23+
"type": "git",
24+
"url": "https://github.com/microsoft/vscode-python-environments"
25+
},
26+
"bugs": {
27+
"url": "https://github.com/microsoft/vscode-python-environments/issues"
28+
},
29+
"scripts": {
30+
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node -e \"process.exitCode = 1\"",
31+
"prepack": "npm run all:publish",
32+
"all:publish": "git clean -xfd . && npm install && npm run compile",
33+
"compile": "tsc -b ./tsconfig.json",
34+
"clean": "node -e \"const fs = require('fs'); fs.rmSync('./out', { recursive: true, force: true });\""
35+
},
36+
"devDependencies": {
37+
"@types/node": "^22.0.0",
38+
"@types/vscode": "^1.99.0",
39+
"typescript": "^5.1.3"
40+
}
41+
}

0 commit comments

Comments
 (0)