Skip to content

Commit 059eca5

Browse files
authored
Merge pull request #66 from sourcegraph/pyright-sync-2023-04-03
sync: pyright 2023 04 03
2 parents a66365b + a6e61dd commit 059eca5

File tree

3,302 files changed

+146270
-50795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,302 files changed

+146270
-50795
lines changed

.github/workflows/build.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: 'Build'
2+
3+
env:
4+
NODE_VERSION: '16' # Shipped with VS Code.
5+
ARTIFACT_NAME_VSIX: vsix
6+
VSIX_NAME: vscode-pyright.vsix
7+
8+
on:
9+
push:
10+
tags:
11+
- '1.1.[0-9][0-9][0-9]'
12+
13+
jobs:
14+
build:
15+
if: github.repository == 'microsoft/pyright'
16+
runs-on: ubuntu-latest
17+
name: Build
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ env.NODE_VERSION }}
27+
28+
- name: Get npm cache directory
29+
id: npm-cache
30+
run: |
31+
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
32+
33+
- uses: actions/cache@v3
34+
with:
35+
path: ${{ steps.npm-cache.outputs.dir }}
36+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-node-
39+
40+
- run: npm run install:all
41+
42+
- name: Build VSIX
43+
working-directory: packages/vscode-pyright
44+
run: |
45+
npm run package
46+
mv pyright-*.vsix ${{ env.VSIX_NAME }}
47+
48+
- uses: actions/upload-artifact@v3
49+
with:
50+
name: ${{ env.ARTIFACT_NAME_VSIX }}
51+
path: packages/vscode-pyright/${{ env.VSIX_NAME }}
52+
53+
create_release:
54+
if: github.repository == 'microsoft/pyright'
55+
runs-on: ubuntu-latest
56+
name: Create release
57+
needs: [build]
58+
59+
steps:
60+
- name: Download artifacts
61+
uses: actions/download-artifact@v3
62+
with:
63+
path: artifacts
64+
65+
# TODO: If the release already exists (tag created via the GUI), reuse it.
66+
- name: Create release
67+
id: create_release
68+
uses: ncipollo/release-action@v1
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
name: Published ${{ github.ref_name }}
73+
draft: true
74+
artifacts: ./artifacts/${{ env.ARTIFACT_NAME_VSIX }}/${{ env.VSIX_NAME }}
75+
artifactContentType: application/zip

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Checkout repository
35-
uses: actions/checkout@v2
35+
uses: actions/checkout@v3
3636

3737
# Initializes the CodeQL tools for scanning.
3838
- name: Initialize CodeQL

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
VSIX_NAME: vscode-pyright.vsix
9+
NODE_VERSION: '16' # Shipped with VS Code.
10+
11+
jobs:
12+
publish_extension:
13+
if: ${{ github.repository == 'microsoft/pyright' }}
14+
runs-on: ubuntu-latest
15+
name: Publish extension to marketplace
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ env.NODE_VERSION }}
23+
24+
- run: npm install
25+
26+
- name: Download VSIX
27+
uses: i3h/download-release-asset@v1
28+
with:
29+
owner: microsoft
30+
repo: pyright
31+
tag: ${{ github.event.release.tag_name }}
32+
file: ${{ env.VSIX_NAME }}
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
# https://code.visualstudio.com/api/working-with-extensions/publishing-extension
36+
- name: Install VSCE
37+
run: |
38+
npm install -g "vsce@$(jq -r '.dependencies.vsce.version' < packages/vscode-pyright/package-lock.json)"
39+
npx vsce --version
40+
41+
# https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token
42+
- name: Publish VSIX
43+
run: npx vsce publish --packagePath ${{ env.VSIX_NAME }} --pat ${{ secrets.VSCE_TOKEN }} --noVerify

.github/workflows/validation.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ jobs:
1818
name: Typecheck
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2222

23-
- uses: actions/setup-node@v2-beta
23+
- uses: actions/setup-node@v3
2424
with:
2525
node-version: ${{ env.NODE_VERSION }}
2626

2727
- name: Get npm cache directory
2828
id: npm-cache
2929
run: |
3030
echo "::set-output name=dir::$(npm config get cache)"
31-
- uses: actions/cache@v2
31+
- uses: actions/cache@v3
3232
with:
3333
path: ${{ steps.npm-cache.outputs.dir }}
3434
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -45,17 +45,17 @@ jobs:
4545
name: Style
4646

4747
steps:
48-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v3
4949

50-
- uses: actions/setup-node@v2-beta
50+
- uses: actions/setup-node@v3
5151
with:
5252
node-version: ${{ env.NODE_VERSION }}
5353

5454
- name: Get npm cache directory
5555
id: npm-cache
5656
run: |
5757
echo "::set-output name=dir::$(npm config get cache)"
58-
- uses: actions/cache@v2
58+
- uses: actions/cache@v3
5959
with:
6060
path: ${{ steps.npm-cache.outputs.dir }}
6161
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -80,9 +80,9 @@ jobs:
8080
needs: typecheck
8181

8282
steps:
83-
- uses: actions/checkout@v2
83+
- uses: actions/checkout@v3
8484

85-
- uses: actions/setup-node@v2-beta
85+
- uses: actions/setup-node@v3
8686
with:
8787
node-version: ${{ env.NODE_VERSION }}
8888

@@ -93,7 +93,7 @@ jobs:
9393
id: npm-cache
9494
run: |
9595
echo "::set-output name=dir::$(npm config get cache)"
96-
- uses: actions/cache@v2
96+
- uses: actions/cache@v3
9797
if: runner.os != 'Windows'
9898
with:
9999
path: ${{ steps.npm-cache.outputs.dir }}
@@ -113,17 +113,17 @@ jobs:
113113
needs: typecheck
114114

115115
steps:
116-
- uses: actions/checkout@v2
116+
- uses: actions/checkout@v3
117117

118-
- uses: actions/setup-node@v2-beta
118+
- uses: actions/setup-node@v3
119119
with:
120120
node-version: ${{ env.NODE_VERSION }}
121121

122122
- name: Get npm cache directory
123123
id: npm-cache
124124
run: |
125125
echo "::set-output name=dir::$(npm config get cache)"
126-
- uses: actions/cache@v2
126+
- uses: actions/cache@v3
127127
with:
128128
path: ${{ steps.npm-cache.outputs.dir }}
129129
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,25 @@
4747
"${workspaceRoot}/packages/vscode-pyright/dist/**/*.js"
4848
]
4949
},
50+
{
51+
"name": "Pyright extension (watch)",
52+
"type": "extensionHost",
53+
"request": "launch",
54+
"runtimeExecutable": "${workspaceRoot}/packages/vscode-pyright/dist/extension.js",
55+
"preLaunchTask": "Watch extension",
56+
"args": [
57+
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode-pyright",
58+
// The published extension is named "ms-pyright.pyright", but in debug mode it's "ms-pyright.vscode-pyright"
59+
// to allow the extension code to participate in the lerna monorepo. Make sure that the published extension
60+
// isn't enabled, otherwise both are loaded and conflict.
61+
"--disable-extension=ms-pyright.pyright"
62+
],
63+
"smartStep": true,
64+
"sourceMaps": true,
65+
"outFiles": [
66+
"${workspaceRoot}/packages/vscode-pyright/dist/**/*.js"
67+
]
68+
},
5069
{
5170
"name": "Pyright attach server",
5271
"type": "node",

.vscode/tasks.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@
1818
"fileLocation": "absolute",
1919
"pattern": [
2020
{
21-
"kind": "location",
22-
"regexp": "(ERROR|WARNING) in (.*?):(\\d+):(\\d+)",
23-
"severity": 1,
24-
"file": 2,
25-
"line": 3,
26-
"column": 4
27-
},
28-
{
29-
"regexp": "\\s*(@typescript-eslint\\/.+):\\s*(.*)$",
30-
"code": 1,
31-
"message": 2
32-
}
21+
"regexp": "\\[tsl\\] (ERROR|WARNING) in (.*)?\\((\\d+),(\\d+)\\)",
22+
"severity": 1,
23+
"file": 2,
24+
"line": 3,
25+
"column": 4
26+
},
27+
{
28+
"regexp": "\\s*TS(\\d+):\\s*(.*)$",
29+
"code": 1,
30+
"message": 2
31+
}
3332
],
3433
"background": {
3534
"activeOnStart": true,

build/checkLockIndent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
//@ts-check
33

4-
// Lerna doesn't do a good job preserving the indention in lock files.
4+
// Lerna doesn't do a good job preserving the indentation in lock files.
55
// Check that the lock files are still indented correctly, otherwise
66
// the change will cause problems with merging and the updateDeps script.
77

build/skipBootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This can be used to write npm script like:
33
// node ./build/skipBootstrap.js || lerna bootstrap
44
// Which means "skip lerna bootstrap if SKIP_LERNA_BOOTSTRAP is set".
5-
// This prevents suprious bootstraps in nested lerna repos.
5+
// This prevents spurious bootstraps in nested lerna repos.
66

77
if (!process.env.SKIP_LERNA_BOOTSTRAP) {
88
process.exit(1);

docs/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
![Pyright](img/PyrightLarge.png)
2+
3+
# Static type checker for Python
4+
5+
Pyright is a full-featured, standards-based static type checker for Python. It is designed for high performance and can be used with large Python source bases.
6+
7+
Pyright includes both a [command-line tool](command-line.md) and an [extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyright).
8+
9+

docs/_navbar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Github Site](https://github.com/Microsoft/pyright)

docs/_sidebar.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
- Getting Started
2+
3+
- [Installing Pyright](installation.md)
4+
- [Getting Started](getting-started.md)
5+
- [Static Typing](type-concepts.md)
6+
- [Features](features.md)
7+
8+
- Customization
9+
10+
- [Configuration](configuration.md)
11+
- [Configuration Options](configuration.md#main-configuration-options)
12+
- [Diagnostic Rules](configuration.md#type-check-diagnostics-settings)
13+
- [Execution Environments](configuration.md#execution-environment-options)
14+
- [Sample pyrightconfig.json](configuration.md#sample-config-file)
15+
- [Sample pyproject.toml](configuration.md#sample-pyprojecttoml-file)
16+
- [Diagnostic Rule Defaults](configuration.md#diagnostic-rule-defaults)
17+
- [Language Server Settings](settings.md)
18+
- [Command Line Interface](command-line.md)
19+
- [Controlling Behavior With Comments](comments.md)
20+
- [Continuous Integration](ci-integration.md)
21+
22+
- Usage
23+
24+
- [Advanced Type Concepts](type-concepts-advanced.md)
25+
- [Type Inference](type-inference.md)
26+
- [Import Statements](import-statements.md)
27+
- [Import Resolution](import-resolution.md)
28+
- [Extending Builtins](builtins.md)
29+
- [Type Stubs](type-stubs.md)
30+
- [Types in Libraries](typed-libraries.md)
31+
- [Differences from Mypy](mypy-comparison.md)
32+
- [Commands](commands.md)
33+
34+
- Development
35+
36+
- [Building & Debugging](build-debug.md)
37+
- [Pyright Internals](internals.md)
38+
39+

docs/build-debug.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## Building Pyright
22

33
To install the dependencies for all packages in the repo:
4-
1. Install [nodejs](https://nodejs.org/en/) version 14.x
4+
1. Install [nodejs](https://nodejs.org/en/) version 16.x
55
2. Open terminal window in main directory of cloned source
6-
3. Execute `npm install` to install dependencies
6+
3. Execute `npm run install:all` to install dependencies for projects and sub-projects
77

88

99
## Building the CLI

docs/builtins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Extending Builtins
1+
## Extending Builtins
22

33
The Python interpreter implicitly adds a set of symbols that are available within every module even though they are not explicitly imported. These so-called “built in” symbols include commonly-used types and functions such as “list”, “dict”, “int”, “float”, “min”, and “len”.
44

0 commit comments

Comments
 (0)