![Pyright](/docs/img/PyrightLarge.png)
# Static type checker for Python
### Speed
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.
### Configurability
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.
### Type Checking Features
* [PEP 484](https://www.python.org/dev/peps/pep-0484/) type hints including generics
* [PEP 487](https://www.python.org/dev/peps/pep-0487/) simpler customization of class creation
* [PEP 526](https://www.python.org/dev/peps/pep-0526/) syntax for variable annotations
* [PEP 544](https://www.python.org/dev/peps/pep-0544/) structural subtyping
* [PEP 561](https://www.python.org/dev/peps/pep-0561/) distributing and packaging type information
* [PEP 563](https://www.python.org/dev/peps/pep-0563/) postponed evaluation of annotations
* [PEP 570](https://www.python.org/dev/peps/pep-0570/) position-only parameters
* [PEP 585](https://www.python.org/dev/peps/pep-0585/) type hinting generics in standard collections
* [PEP 586](https://www.python.org/dev/peps/pep-0586/) literal types
* [PEP 589](https://www.python.org/dev/peps/pep-0589/) typed dictionaries
* [PEP 591](https://www.python.org/dev/peps/pep-0591/) final qualifier
* [PEP 593](https://www.python.org/dev/peps/pep-0593/) flexible variable annotations
* [PEP 604](https://www.python.org/dev/peps/pep-0604/) complementary syntax for unions
* [PEP 612](https://www.python.org/dev/peps/pep-0612/) parameter specification variables
* [PEP 613](https://www.python.org/dev/peps/pep-0613/) explicit type aliases
* [PEP 635](https://www.python.org/dev/peps/pep-0635/) structural pattern matching
* [PEP 637](https://www.python.org/dev/peps/pep-0637/) indexing with keyword arguments
* [PEP 646](https://www.python.org/dev/peps/pep-0646/) variadic generics
* [PEP 647](https://www.python.org/dev/peps/pep-0647/) user-defined type guards
* [PEP 655](https://www.python.org/dev/peps/pep-0655/) required typed dictionary items
* Type inference for function return values, instance variables, class variables, and globals
* Type guards that understand conditional code flow constructs like if/else statements
### VS Code Integration
Pyright ships as both a command-line tool and a VS Code extension that provides many powerful features that help improve programming efficiency.
### VS Code Language Features
The VS Code extension supports many time-saving language features including:
* Intelligent type completion of keywords, symbols, and import names appears when editing
* Import statements are automatically inserted when necessary for type completions
* Signature completion tips help when filling in arguments for a call
* Hover over symbols to provide type information and doc strings
* Find Definitions to quickly go to the location of a symbol’s definition
* Find References to find all references to a symbol within a code base
* Rename Symbol to rename all references to a symbol within a code base
* Find Symbols within the current document or within the entire workspace
* View call hierarchy information — calls made within a function and places where a function is called
* Organize Imports command for automatically ordering imports according to PEP8 rules
* Type stub generation for third-party libraries
### Built-in Type Stubs
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.
### Command-line Tool or Visual Studio Code Extension
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/).
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.
## Installation
### VS Code Extension
For most VS Code users, we recommend using the Pylance extension rather than Pyright. Pylance incorporates the pyright type checker but features additional capabilities such as IntelliCode and semantic token highlighting. You can install the latest-published version of the Pylance VS Code extension directly from VS Code. Simply open the extensions panel and search for `pylance`.
### Vim
For vim/neovim users, you can install [coc-pyright](https://github.com/fannheyward/coc-pyright), the Pyright extension for coc.nvim.
Alternatively, [ALE](https://github.com/dense-analysis/ale) will automatically check your code with Pyright, without requiring any additional configuration.
### Sublime Text
For sublime text users, you can install the [LSP-pyright](https://github.com/sublimelsp/LSP-pyright) plugin from [package control](https://packagecontrol.io/packages/LSP-pyright).
### Emacs
For emacs users, you can install [lsp-mode](https://github.com/emacs-lsp/lsp-mode) that includes [lsp-pyright](https://github.com/emacs-lsp/lsp-pyright).
To activate the pyright extension follow the instructions in the [docs](https://emacs-lsp.github.io/lsp-pyright/).
### Command-line
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](https://nodejs.org).
To install pyright globally:
`npm install -g pyright`
On MacOS or Linux, sudo is required to install globally:
`sudo npm install -g pyright`
Once installed, you can run the tool from the command line as follows:
`pyright <options>`
To update to the latest version:
`sudo npm update -g pyright`
## Using Pyright with VS Code Python Extension
Pyright’s type-checking functionality and language features are now incorporated into a VS Code extension called [Pylance](https://github.com/microsoft/pylance-release), the officially supported Python Language Server from Microsoft. Pylance is designed to work with the Python extension for VS Code. In addition to Pyright’s functionality, Pylance adds compatibility with several advanced features including IntelliCode for AI-assisted completions. If you are a VS Code user, we recommend that you uninstall Pyright and instead install Pylance. You will get all the benefits of Pyright and more!
## Documentation
* [Getting Started with Type Checking](/docs/getting-started.md)
* [Type Concepts](/docs/type-concepts.md)
* [Continuous Integration (CI)](/docs/ci-integration.md)
* [Command-line Options](/docs/command-line.md)
* [Configuration](/docs/configuration.md)
* [Settings](/docs/settings.md)
* [Comments](/docs/comments.md)
* [Type Inference](/docs/type-inference.md)
* [Import Resolution](/docs/import-resolution.md)
* [Type Stubs](/docs/type-stubs.md)
* [Types in Libraries](/docs/typed-libraries.md)
* [Commands](/docs/commands.md)
* [Building & Debugging](/docs/build-debug.md)
* [Pyright Internals](/docs/internals.md)
For additional information about Python static typing, refer to this community-maintained [Python Type School](https://github.com/python/typing/discussions).
## Limitations
Pyright provides support for Python 3.0 and newer. There is currently no plan to support older versions.
## Community
Do you have questions about Pyright or Python type annotations in general? Post your questions in [the discussion section](https://github.com/micro
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
IDP是一款自研AI IDE(人工智能集成开发环境),专为AI和数据科学开发人员(如数据科学家、算法工程师)打造,帮助数据科学家和算法工程师提升AI开发效率。IDP原生支持Python和SQL——这是在AI和数据科学领域中使用最广泛的两种语言。针对数据科学家和算法工程师的使用习惯和AI开发的特点,还应具备“效率插件”,如版本管理、环境管理与克隆、变量管理、预置代码片段、智能代码辅助等,减少数据科学家和算法工程师用于开发准备和辅助工作的时间。
资源推荐
资源详情
资源评论
收起资源包目录
IDP 是一款面向据科学家和大数据工程师的开源 AI IDE (2000个子文件)
AUTHORS 12KB
.babelrc 740B
lint.js.bak 10KB
remote-lint.js.bak 2KB
package.json.bak 1024B
idp_note.conf 1KB
pip.conf 330B
ambiance.css 26KB
codemirror.css 9KB
markdown-editor.css 8KB
abbott.css 8KB
markdown.css 7KB
codemirror.css 6KB
quickfix-dark.css 6KB
lint.css 6KB
quickfix-light.css 6KB
solarized.css 5KB
mdn-like.css 5KB
markdown.css 5KB
show-hint.css 5KB
liquibyte.css 4KB
merge.css 3KB
yonce.css 3KB
xq-dark.css 3KB
material-palenight.css 3KB
material-ocean.css 3KB
duotone-light.css 3KB
darcula.css 3KB
lesser-dark.css 3KB
duotone-dark.css 3KB
material-darker.css 3KB
ayu-mirage.css 2KB
material.css 2KB
icecoder.css 2KB
pastel-on-dark.css 2KB
markdowncolor.css 2KB
oceanic-next.css 2KB
ttcn.css 2KB
shadowfox.css 2KB
tomorrow-night-eighties.css 2KB
ayu-dark.css 2KB
moxer.css 2KB
base16-dark.css 2KB
erlang-dark.css 2KB
xq-light.css 2KB
monokai.css 2KB
twilight.css 2KB
vibrant-ink.css 2KB
base16-light.css 2KB
mbo.css 2KB
nord.css 2KB
paraiso-light.css 2KB
paraiso-dark.css 2KB
3024-night.css 2KB
dracula.css 2KB
seti.css 2KB
zenburn.css 2KB
3024-day.css 2KB
abcdef.css 2KB
the-matrix.css 2KB
blackboard.css 2KB
gruvbox-dark.css 2KB
lucario.css 2KB
yeti.css 2KB
tern.css 2KB
midnight.css 2KB
panda-syntax.css 2KB
rubyblue.css 2KB
tomorrow-night-bright.css 2KB
night.css 2KB
cobalt.css 2KB
colorforth.css 2KB
idea.css 2KB
railscasts.css 1KB
hopscotch.css 1KB
isotope.css 1KB
bespin.css 1KB
simplescrollbars.css 1KB
eclipse.css 1KB
neo.css 947B
elegant.css 781B
ssms.css 751B
index.css 739B
neat.css 688B
index.css 687B
juejin.css 517B
dialog.css 507B
tiki.css 439B
foldgutter.css 435B
tiddlywiki.css 220B
matchesonscrollbar.css 188B
index.css 175B
fullscreen.css 116B
ambiance-mobile.css 103B
nyc_taxi.csv 5KB
Dockerfile 6KB
fedora.Dockerfile 1KB
common.Dockerfile 889B
index.ejs 2KB
open.ejs 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6651
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功