You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+45-36
Original file line number
Diff line number
Diff line change
@@ -3,54 +3,64 @@
3
3
# Static type checker for Python
4
4
5
5
### Speed
6
-
Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fast incremental updates when files are modified.
6
+
7
+
Pyright is a fast type checker meant for large Python source bases. It can run in a "watch" mode and performs fast incremental updates when files are modified.
7
8
8
9
### Configurability
9
-
Pyright supports [configuration files](/docs/configuration.md) that provide granular control over settings. Different “execution environments” can be associated with subdirectories within a source base. Each environment can specify different module search paths, python language versions, and platform targets.
10
+
11
+
Pyright supports [configuration files](/docs/configuration.md) that provide granular control over settings. Different "execution environments" can be associated with subdirectories within a source base. Each environment can specify different module search paths, python language versions, and platform targets.
10
12
11
13
### Type Checking Features
12
-
*[PEP 484](https://www.python.org/dev/peps/pep-0484/) type hints including generics
13
-
*[PEP 526](https://www.python.org/dev/peps/pep-0526/) syntax for variable annotations
- Type inference for function return values, instance variables, class variables, and globals
20
+
- Smart type constraints that understand conditional code flow constructs like if/else statements
18
21
19
22
### VS Code Integration
23
+
20
24
Pyright ships as both a command-line tool and a VS Code extension that provides many powerful features that help improve programming efficiency.
21
25
22
26
### VS Code Language Features
27
+
23
28
The VS Code extension supports many time-saving language features including:
24
29
25
-
* Intelligent type completion of keywords, symbols, and import names appears when editing
26
-
* Import statements are automatically inserted when necessary for type completions
27
-
* Signature completion tips help when filling in arguments for a call
28
-
* Hover over symbols to provide type information and doc strings
29
-
*Find Definitions to quickly go to the location of a symbol’s definition
30
-
* Find References to find all references to a symbol within a code base
31
-
* Rename Symbol to rename all references to a symbol within a code base
32
-
* Find Symbols within the current document or within the entire workspace
33
-
* Organize Imports command for automatically ordering imports according to PEP8 rules
34
-
* Type stub generation for third-party libraries
30
+
- Intelligent type completion of keywords, symbols, and import names appears when editing
31
+
- Import statements are automatically inserted when necessary for type completions
32
+
- Signature completion tips help when filling in arguments for a call
33
+
- Hover over symbols to provide type information and doc strings
34
+
-Find Definitions to quickly go to the location of a symbol's definition
35
+
- Find References to find all references to a symbol within a code base
36
+
- Rename Symbol to rename all references to a symbol within a code base
37
+
- Find Symbols within the current document or within the entire workspace
38
+
- Organize Imports command for automatically ordering imports according to PEP8 rules
39
+
- Type stub generation for third-party libraries
35
40
36
41
### Built-in Type Stubs
42
+
37
43
Pyright includes a recent copy of the stdlib type stubs from [Typeshed](https://github.com/python/typeshed). It can be configured to use another (perhaps more recent or modified) copy of the Typeshed type stubs. Of course, it also works with custom type stub files that are part of your project.
38
44
39
45
### Command-line Tool or Visual Studio Code Extension
46
+
40
47
Pyright includes both a [command-line tool](/docs/command-line.md) and an [extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyright) that implements the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/).
41
48
42
49
For rich Python editing and debugging capabilities with Visual Studio Code, be sure to also install the official [Microsoft Python extension for Visual Studio Code](https://marketplace.visualstudio.com/itemdetails?itemName=ms-python.python) as Pyright only provides syntax and type checking.
43
50
44
-
45
51
## Installation
52
+
46
53
### VS Code Extension
54
+
47
55
You can install the latest-published version of the Pyright VS Code extension directly from VS Code. Simply open the extensions panel and search for `pyright`.
48
56
49
57
### Vim
58
+
50
59
For vim/neovim users, you can install [coc-pyright](https://github.com/fannheyward/coc-pyright), Pyright extension for coc.nvim.
51
60
52
61
### Command-line
53
-
The latest version of the command-line tool can be installed with npm, which is part of node. If you don't have a recent version of node on your system, install that first from [nodejs.org](nodejs.org).
62
+
63
+
The latest version of the command-line tool can be installed with npm, which is part of node. If you don't have a recent version of node on your system, install that first from [nodejs.org](nodejs.org).
54
64
55
65
To install pyright globally:
56
66
`npm install -g pyright`
@@ -64,42 +74,41 @@ Once installed, you can run the tool from the command line as follows:
64
74
To update to the latest version:
65
75
`sudo npm update -g pyright`
66
76
67
-
68
77
## Using Pyright with VS Code Python Extension
69
-
Pyright provides some features that overlap with functionality provided by the standard VS Code Python extension: “hover”, type completion, definitions, references, rename symbols, etc. You may see duplicate results if Pyright is installed alongside the Python extension. There is currently no way to disable this functionality in the Python extension. If you want to disable these features in Pyright, there is a setting to do so: `pyright.disableLanguageServices`.
70
78
79
+
Pyright provides some features that overlap with functionality provided by the standard VS Code Python extension: "hover", type completion, definitions, references, rename symbols, etc. You may see duplicate results if Pyright is installed alongside the Python extension. There is currently no way to disable this functionality in the Python extension. If you want to disable these features in Pyright, there is a setting to do so: `pyright.disableLanguageServices`.
71
80
72
81
## Documentation
73
-
*[Getting Started with Type Checking](/docs/getting-started.md)
74
-
*[Command-line Options](/docs/command-line.md)
75
-
*[Configuration](/docs/configuration.md)
76
-
*[Settings](/docs/settings.md)
77
-
*[Comments](/docs/comments.md)
78
-
*[Import Resolution](/docs/import-resolution.md)
79
-
*[Type Stubs](/docs/type-stubs.md)
80
-
*[Commands](/docs/commands.md)
81
-
*[Building & Debugging](/docs/build-debug.md)
82
-
*[Pyright Internals](/docs/internals.md)
83
82
83
+
-[Getting Started with Type Checking](/docs/getting-started.md)
84
+
-[Command-line Options](/docs/command-line.md)
85
+
-[Configuration](/docs/configuration.md)
86
+
-[Settings](/docs/settings.md)
87
+
-[Comments](/docs/comments.md)
88
+
-[Import Resolution](/docs/import-resolution.md)
89
+
-[Type Stubs](/docs/type-stubs.md)
90
+
-[Commands](/docs/commands.md)
91
+
-[Building & Debugging](/docs/build-debug.md)
92
+
-[Pyright Internals](/docs/internals.md)
84
93
85
94
## Limitations
86
-
Pyright currently provides support for Python 3.0 and newer. There is currently no plan to support older versions.
87
95
96
+
Pyright currently provides support for Python 3.0 and newer. There is currently no plan to support older versions.
88
97
89
98
## Community
90
-
Do you have questions about Pyright or Python type annotations in general? Post your questions in this [gitter channel](https://gitter.im/microsoft-pyright/community).
91
99
100
+
Do you have questions about Pyright or Python type annotations in general? Post your questions in this [gitter channel](https://gitter.im/microsoft-pyright/community).
92
101
93
102
## FAQ
103
+
94
104
**Q:** What is the difference between pyright and the [Microsoft Python Visual Studio Code plugin](https://github.com/Microsoft/vscode-python)?
95
105
96
-
**A:** Pyright is focused on type checking. The Python VS Code plugin is Microsoft’s officially-supported extension for VS Code and provides a diverse array of features including debugging, test case management, linter plugins, and more. Pyright can be used alongside the Microsoft Python extension.
106
+
**A:** Pyright is focused on type checking. The Python VS Code plugin is Microsoft's officially-supported extension for VS Code and provides a diverse array of features including debugging, test case management, linter plugins, and more. Pyright can be used alongside the Microsoft Python extension.
97
107
98
108
**Q:** What is the long-term plan for Pyright?
99
109
100
110
**A:** Pyright is a side project with no dedicated team. There is no guarantee of continued development on the project. If you find it useful, feel free to use it and contribute to the code base.
101
111
102
-
103
112
## Contributing
104
113
105
114
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fast incremental updates when files are modified.
4
+
5
+
Pyright is a fast type checker meant for large Python source bases. It can run in a "watch" mode and performs fast incremental updates when files are modified.
5
6
6
7
### Configurability
7
-
Pyright supports [configuration files](/docs/configuration.md) that provide granular control over settings. Different “execution environments” can be associated with subdirectories within a source base. Each environment can specify different module search paths, python language versions, and platform targets.
8
+
9
+
Pyright supports [configuration files](/docs/configuration.md) that provide granular control over settings. Different "execution environments" can be associated with subdirectories within a source base. Each environment can specify different module search paths, python language versions, and platform targets.
8
10
9
11
### Type Checking Features
10
-
*[PEP 484](https://www.python.org/dev/peps/pep-0484/) type hints including generics
11
-
*[PEP 526](https://www.python.org/dev/peps/pep-0526/) syntax for variable annotations
- Type inference for function return values, instance variables, class variables, and globals
18
+
- Smart type constraints that understand conditional code flow constructs like if/else statements
16
19
17
20
### VS Code Language Features
21
+
18
22
The VS Code extension supports many time-saving language features including:
19
23
20
-
* Intelligent type completion of keywords, symbols, and import names appears when editing
21
-
* Import statements are automatically inserted when necessary for type completions
22
-
* Signature completion tips help when filling in arguments for a call
23
-
* Hover over symbols to provide type information and doc strings
24
-
*Find Definitions to quickly go to the location of a symbol’s definition
25
-
* Find References to find all references to a symbol within a code base
26
-
* Rename Symbol to rename all references to a symbol within a code base
27
-
* Find Symbols within the current document or within the entire workspace
28
-
* Organize Imports command for automatically ordering imports according to PEP8 rules
29
-
* Type stub generation for third-party libraries
24
+
- Intelligent type completion of keywords, symbols, and import names appears when editing
25
+
- Import statements are automatically inserted when necessary for type completions
26
+
- Signature completion tips help when filling in arguments for a call
27
+
- Hover over symbols to provide type information and doc strings
28
+
-Find Definitions to quickly go to the location of a symbol's definition
29
+
- Find References to find all references to a symbol within a code base
30
+
- Rename Symbol to rename all references to a symbol within a code base
31
+
- Find Symbols within the current document or within the entire workspace
32
+
- Organize Imports command for automatically ordering imports according to PEP8 rules
33
+
- Type stub generation for third-party libraries
30
34
31
35
### Built-in Type Stubs
32
-
Pyright includes a recent copy of the stdlib type stubs from [Typeshed](https://github.com/python/typeshed). It can be configured to use another (perhaps more recent or modified) copy of the Typeshed type stubs. Of course, it also works with custom type stub files that are part of your project.
33
36
37
+
Pyright includes a recent copy of the stdlib type stubs from [Typeshed](https://github.com/python/typeshed). It can be configured to use another (perhaps more recent or modified) copy of the Typeshed type stubs. Of course, it also works with custom type stub files that are part of your project.
34
38
35
39
For more details, refer to the [README](https://github.com/Microsoft/pyright/blob/master/README.md) on the Pyright GitHub site.
0 commit comments