Skip to content
Open
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 .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.json linguist-language=JSON-with-Comments
**/pnpm-lock.yaml text eol=lf
11 changes: 0 additions & 11 deletions .github/actions/cfs-npm-cache/action.yml

This file was deleted.

75 changes: 43 additions & 32 deletions .github/actions/cfs-npm-install/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# Does an npm install using our private Azure Artifacts registry which requires OIDC authentication.
# Does an pnpm install using our private Azure Artifacts registry which requires OIDC authentication.
# Workflows that use this action must add the id-token: write permission.

name: npm install (CFS)
name: pnpm install (CFS)
description: Authenticate to the CFS npm registry and install the pnpm workspace.

on:
workflow_call:
inputs:
working-directory:
description: Directory in which to run pnpm install
default: '.'
required: false
skip-playwright-browser-download:
description: Skip Playwright browser downloads during dependency installation
default: '1'
required: false

runs:
using: composite
steps:
- name: Azure OIDC Login
uses: azure/login@v2
uses: azure/login@v3
with:
# These are not secret values and are safe to commit to the repository
client-id: 92c669e8-02ad-4ce6-ad73-f222fc7177e2
Expand All @@ -20,37 +28,40 @@ runs:
- name: Setup CFS Credentials
shell: bash
id: npm-auth
# The resource guid is the app id of Azure DevOps
run: |
echo "token=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 | jq -r .accessToken)" >> $GITHUB_OUTPUT
token="$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 | jq -r .accessToken)"
echo "::add-mask::$token"
echo "token=$token" >> "$GITHUB_OUTPUT"

- uses: ./.github/actions/cfs-npm-authenticate
with:
working-directory: .
token: ${{ steps.npm-auth.outputs.token }}

- uses: ./.github/actions/cfs-npm-authenticate
with:
working-directory: packages/pyright
token: ${{ steps.npm-auth.outputs.token }}

- uses: ./.github/actions/cfs-npm-authenticate
with:
working-directory: packages/pyright-internal
token: ${{ steps.npm-auth.outputs.token }}

- uses: ./.github/actions/cfs-npm-authenticate
with:
working-directory: packages/vscode-pyright
token: ${{ steps.npm-auth.outputs.token }}

- uses: ./.github/actions/cfs-npm-cache
- name: Create temporary npm configuration
shell: bash
env:
CFS_TOKEN: ${{ steps.npm-auth.outputs.token }}
run: |
auth_dir="${{ runner.temp }}/cfs-npm-auth"
npmrc="$auth_dir/.npmrc"
feed_url="//devdiv.pkgs.visualstudio.com/DevDiv/_packaging/Pylance_PublicPackages"
mkdir -p "$auth_dir"
{
echo "registry=https:$feed_url/npm/registry/"
echo
echo "$feed_url/npm/registry/:username=github-actions"
echo "$feed_url/npm/registry/:_authToken=$CFS_TOKEN"
echo "$feed_url/npm/registry/:email=actions@github.com"
echo "$feed_url/npm:username=github-actions"
echo "$feed_url/npm:_authToken=$CFS_TOKEN"
echo "$feed_url/npm:email=actions@github.com"
} > "$npmrc"

- run: npm run install:all
- name: Install pnpm dependencies
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
NPM_CONFIG_USERCONFIG: ${{ runner.temp }}/cfs-npm-auth/.npmrc
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: ${{ inputs.skip-playwright-browser-download }}
run: pnpm install --frozen-lockfile --prefer-offline

- name: Cleanup .npmrc
- name: Cleanup temporary npm configuration
if: always()
shell: bash
run: rm .npmrc
working-directory: ${{ inputs.working-directory }}
run: rm -rf "${{ runner.temp }}/cfs-npm-auth"
18 changes: 13 additions & 5 deletions .github/actions/choose-npm-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
# This action decides whether to use CFS based on the source of the branch in play.

name: npm install (consider using CFS)
name: pnpm install (consider using CFS)
description: Use CFS for trusted branches and the public npm registry for fork pull requests.

on:
workflow_call:
inputs:
working-directory:
description: Directory in which to run pnpm install
default: '.'
required: false

runs:
using: composite
steps:
- name: CFS npm install
- name: CFS pnpm install
if: github.event.pull_request.head.repo.fork != true
uses: ./.github/actions/cfs-npm-install
with:
working-directory: ${{ inputs.working-directory }}

- name: Standard npm install
- name: Standard pnpm install
if: github.event.pull_request.head.repo.fork == true
uses: ./.github/actions/standard-npm-install
with:
working-directory: ${{ inputs.working-directory }}
49 changes: 0 additions & 49 deletions .github/actions/npm-cache-dir/action.yml

This file was deleted.

21 changes: 13 additions & 8 deletions .github/actions/standard-npm-install/action.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Standard npm install using the public npm registry.
# Standard pnpm install using the public npm registry.

name: npm install (public registry)
name: pnpm install (public registry)
description: Install the pnpm workspace from the public npm registry.

on:
workflow_call:
inputs:
working-directory:
description: Directory in which to run pnpm install
default: '.'
required: false

runs:
using: composite
steps:
- uses: ./.github/actions/npm-cache-dir

- name: Standard npm install
- name: Standard pnpm install
shell: bash
run: npm run install:all
working-directory: ${{ inputs.working-directory }}
env:
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
run: pnpm run install:all

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info · Optional note

working-directory may point at a package that does not define install:all, while the CFS path runs pnpm install directly. Use the same frozen install command in both paths, or centralize installation after conditional authentication, so both actions support non-root directories consistently.

[verified]

6 changes: 3 additions & 3 deletions .github/agents/typeshed-update-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Track changes including:
Run these focused tests before full-suite reruns when related files change.

- constructor callable and default constructor behavior:
- `cd packages/pyright-internal && npm run test:norebuild -- typeEvaluator6.test.ts -t "ConstructorCallable1|ConstructorCallable2|Constructor28" --runInBand`
- `cd packages/pyright-internal && pnpm run test:norebuild -- typeEvaluator6.test.ts -t "ConstructorCallable1|ConstructorCallable2|Constructor28" --runInBand`
- contextmanager / generator behavior:
- `cd packages/pyright-internal && npm run test:norebuild -- typeEvaluator2.test.ts -t Solver7 --runInBand`
- `cd packages/pyright-internal && pnpm run test:norebuild -- typeEvaluator2.test.ts -t Solver7 --runInBand`
- positional-only parameter behavior:
- `cd packages/pyright-internal && npm run test:norebuild -- typeEvaluator1.test.ts -t Call3 --runInBand`
- `cd packages/pyright-internal && pnpm run test:norebuild -- typeEvaluator1.test.ts -t Call3 --runInBand`

---

Expand Down
26 changes: 13 additions & 13 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ Pyright is a static type checker for Python, written in TypeScript. It ships as

```bash
# Install all packages (from repo root)
npm install
pnpm install

# Build the core library
cd packages/pyright-internal && npm run build
cd packages/pyright-internal && pnpm run build

# Run all tests (builds test server first)
cd packages/pyright-internal && npm test
cd packages/pyright-internal && pnpm test

# Run all tests without rebuilding the test server (faster iteration)
cd packages/pyright-internal && npm run test:norebuild
cd packages/pyright-internal && pnpm run test:norebuild

# Run a single test file
cd packages/pyright-internal && npx jest typeEvaluator1.test --forceExit
cd packages/pyright-internal && pnpm exec jest typeEvaluator1.test --forceExit

# Run a single test by name
cd packages/pyright-internal && npx jest -t "Generic1" --forceExit
cd packages/pyright-internal && pnpm exec jest -t "Generic1" --forceExit

# Build the CLI (webpack bundle)
npm run build:cli:dev
pnpm run build:cli:dev

# Build the VS Code extension (webpack bundle)
npm run build:extension:dev
pnpm run build:extension:dev
```

### Linting

```bash
# Run all checks (syncpack + eslint + prettier)
npm run check
pnpm run check

# Individual checks
npm run check:eslint
npm run check:prettier
pnpm run check:eslint
pnpm run check:prettier

# Auto-fix
npm run fix:eslint
npm run fix:prettier
pnpm run fix:eslint
pnpm run fix:prettier
```

## Architecture
Expand Down
Empty file added .npmrc
Empty file.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/package-lock.json
**/pnpm-lock.yaml
**/dist/**
**/out/**
**/typeshed-fallback/**
Expand Down
2 changes: 1 addition & 1 deletion .rpg/last_parsed_sha.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
784698179a5627072df39bbe0fcadb55bb7dd408
af737e1f2106f0fcd1e4c921a347f7873066cad4
Loading