https://github.com/microsoft/pyright Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} microsoft / pyright Public * Notifications * Fork 668 * Star 9.1k Static type checker for Python License View license 9.1k stars 668 forks Star Notifications * Code * Issues 8 * Pull requests 1 * Discussions * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights microsoft/pyright This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 8 branches 367 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone micros] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @msfterictraut msfterictraut Improved error reporting for type mismatch involving a return type th... ... 0d640b9 Jan 2, 2023 Improved error reporting for type mismatch involving a return type th... ...at is a TypedDict. This addresses #4390. 0d640b9 Git stats * 5,616 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github .vscode build docs packages specs .eslintignore .eslintrc.json .gitattributes .gitignore .prettierignore .prettierrc CONTRIBUTING.md LICENSE.txt README.md SECURITY.md lerna.json package-lock.json package.json tsconfig.json View code [ ] Static type checker for Python Speed Configurability Type Checking Features VS Code Integration VS Code Language Features Built-in Type Stubs Command-line Tool or Visual Studio Code Extension Installation VS Code Extension Vim Sublime Text Emacs Command-line Documentation Limitations Community FAQ Contributing README.md Pyright 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 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 type hints including generics * PEP 487 simpler customization of class creation * PEP 526 syntax for variable annotations * PEP 544 structural subtyping * PEP 561 distributing and packaging type information * PEP 563 postponed evaluation of annotations * PEP 570 position-only parameters * PEP 585 type hinting generics in standard collections * PEP 586 literal types * PEP 589 typed dictionaries * PEP 591 final qualifier * PEP 593 flexible variable annotations * PEP 604 complementary syntax for unions * PEP 612 parameter specification variables * PEP 613 explicit type aliases * PEP 635 structural pattern matching * PEP 646 variadic generics * PEP 647 user-defined type guards * PEP 655 required typed dictionary items * PEP 673 Self type * PEP 675 arbitrary literal strings * PEP 681 dataclass transform * PEP 692 (draft) TypedDict for kwargs typing * PEP 695 (draft) Type parameter syntax * PEP 696 (draft) Type defaults for TypeVarLikes * PEP 698 (draft) Override decorator for static typing * 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 . 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 and an extension for Visual Studio Code that implements the 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 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 Vim/neovim users can install coc-pyright, the Pyright extension for coc.nvim. Alternatively, ALE will automatically check your code with Pyright, without requiring any additional configuration. Sublime Text Sublime text users can install the LSP-pyright plugin from package control. Emacs Emacs users can install eglot or lsp-mode with lsp-pyright. Command-line A community-maintained 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 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. 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 Documentation * Getting Started with Type Checking * Type Concepts * Continuous Integration (CI) * Command-line Options * Configuration * Settings * Comments * Type Inference * Differences from Mypy * Import Resolution * Extending Builtins * Type Stubs * Types in Libraries * Commands * Building & Debugging * Pyright Internals For additional information about Python static typing, refer to this community-maintained Python Type School. Limitations Pyright provides support for Python 3.0 and newer. There are no plans to support older versions. Community Do you have questions about Pyright or Python type annotations in general? Post your questions in the discussion section. If you would like to report a bug or request an enhancement, file a new issue in either the pyright or pylance-release 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? A: Pyright is an open-source Python type checker and language server. Pylance leverages Pyright's functionality with additional features, some of which are not open-sourced. 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. The Pyright extension for VS Code is a reference implementation and is not guaranteed to be fully functional or maintained long-term. Contributing This project welcomes contributions and suggestions. For feature and complex bug fix contributions, it is recommended that you first discuss the proposed change with Pyright's 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. 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. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. About Static type checker for Python Resources Readme License View license Code of conduct Code of conduct Security policy Security policy Stars 9.1k stars Watchers 82 watching Forks 668 forks Releases 367 Published 1.1.286 Latest Dec 28, 2022 + 366 releases Used by 420 * @sdip15fa * @samkenxstream * @amenoyoya * @zaourzag * @frenck * @DominicGebhart * @h3abionet * @klcantrell + 412 Contributors 81 * @msfterictraut * @heejaechang * @jakebailey * @erictraut * @bschnurr * @PylanceBot * @debonte * @dependabot[bot] * @rchiodo * @cdce8p * @huguesv + 70 contributors Languages * Python 57.5% * TypeScript 42.4% * JavaScript 0.1% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. 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.