pyright/README.md

79 lines
4.8 KiB
Markdown
Raw Normal View History

2019-03-12 07:33:50 +03:00
![Pyright](/docs/img/PyrightLarge.png)
2019-03-12 07:30:44 +03:00
# Static type checker for Python
2019-03-12 07:30:44 +03:00
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.
2019-03-12 07:30:44 +03:00
### 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).
2019-03-12 06:38:50 +03:00
## Installation
2019-09-18 10:25:20 +03:00
### 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 semantic token highlighting and symbol indexing. 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”.
2019-09-18 10:25:20 +03:00
### Vim
2021-12-15 09:52:00 +03:00
Vim/neovim users 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 if added to the linters list.
2019-09-07 08:17:33 +03:00
### Sublime Text
2021-12-15 09:52:00 +03:00
Sublime text users can install the [LSP-pyright](https://github.com/sublimelsp/LSP-pyright) plugin from [package control](https://packagecontrol.io/packages/LSP-pyright).
### Emacs
Emacs users can install [eglot](https://github.com/joaotavora/eglot) or [lsp-mode](https://github.com/emacs-lsp/lsp-mode) with [lsp-pyright](https://github.com/emacs-lsp/lsp-pyright).
2019-09-18 10:25:20 +03:00
### Command-line
A [community-maintained](https://github.com/RobertCraigie/pyright-python) Python package by the name of “pyright” is available on pypi and conda-forge. This package will automatically install node (which Pyright requires) and keep Pyright up to date.
`pip install pyright`
or
`conda install pyright`
Once installed, you can run the tool from the command line as follows:
`pyright <options>`
Alternatively, you can install the command-line version of Pyright directly from 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 may be required to install globally:
`sudo npm install -g pyright`
To update to the latest version:
`sudo npm update -g pyright`
2019-03-20 22:41:01 +03:00
## Documentation
Full documentation can be found [here](https://microsoft.github.io/pyright)
2019-03-20 22:41:01 +03:00
2019-12-22 23:38:58 +03:00
## Community
Do you have questions about Pyright or Python type annotations in general? Post your questions in [the discussion section](https://github.com/microsoft/pyright/discussions).
2019-12-22 23:38:58 +03:00
2021-12-15 09:52:00 +03:00
If you would like to report a bug or request an enhancement, file a new issue in either the [pyright](https://github.com/microsoft/pyright/issues) or [pylance-release](https://github.com/microsoft/pylance-release/issues) issue tracker. In general, core type checking functionality is associated with Pyright while language service functionality is associated with Pylance, but the same contributors monitor both repos. For best results, provide the information requested in the issue template.
## FAQ
**Q:** What is the difference between Pyright and [Pylance](https://github.com/microsoft/pylance-release)?
2019-03-20 02:07:43 +03:00
**A:** Pyright is an open-source Python type checker and language server. Pylance leverages Pyrights functionality with additional features, some of which are not open-sourced.
2019-04-08 19:48:57 +03:00
2019-04-09 08:55:26 +03:00
**Q:** What is the long-term plan for Pyright?
**A:** Pyright is an officially-supported Microsoft type checker for Python. It will continue to be developed and maintained as an open-source project under its original MIT license terms.
2019-03-12 06:45:56 +03:00
## Contributing
2019-03-12 06:38:50 +03:00
2021-12-15 09:52:00 +03:00
This project welcomes contributions and suggestions. For feature and complex bug fix contributions, it is recommended that you first discuss the proposed change with Pyrights maintainers before submitting the pull request. 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.
2019-03-12 06:38:50 +03:00
2019-04-09 08:55:26 +03:00
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
2019-03-12 06:38:50 +03:00
2019-04-09 08:55:26 +03:00
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.