https://github.com/mtshiba/pylyzer Skip to content Toggle navigation Sign in * 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 Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up 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 {{ message }} mtshiba / pylyzer Public * * Notifications * Fork 21 * Star 1.5k * A fast static code analyzer & language server for Python mtshiba.github.io/pylyzer/ License MIT license 1.5k stars 21 forks Branches Tags Activity Star Notifications * Code * Issues 31 * Pull requests 1 * Discussions * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights mtshiba/pylyzer This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Last commit Last Name Name message commit date Latest commit History 262 Commits .cargo .cargo .github .github .vscode .vscode crates/py2erg crates/py2erg docs docs extension extension images images src src tests tests .gitignore .gitignore .pre-commit-config.yaml .pre-commit-config.yaml Cargo.lock Cargo.lock Cargo.toml Cargo.toml LICENSE LICENSE README.md README.md cargo_publish.ps1 cargo_publish.ps1 cargo_publish.sh cargo_publish.sh mkdocs.yml mkdocs.yml mkdocs_build.bat mkdocs_build.bat publish.sh publish.sh pyproject.toml pyproject.toml setup.py setup.py View all files Repository files navigation * README * MIT license pylyzer [?] pylyzer_logo_with_letters vsm-version Build status Build status pylyzer is a static code analyzer / language server for Python, written in Rust. Installation pip pip install pylyzer cargo (rust package manager) cargo install pylyzer --locked Warning Currently, the stable version of pylyzer cannot be installed with rustc >= 1.76.0 due to a dependency problem. Ref: RustPython/Parser# 114 You can install the latest version from the source. build from source git clone https://github.com/mtshiba/pylyzer.git cargo install --path . Make sure that cargo/rustc is up-to-date, as pylyzer may be written with the latest language features. GitHub Releases What is the advantage over pylint, pyright, pytype, etc.? * Performance On average, pylyzer can inspect Python scripts more than 100 times faster than pytype and pyright ^1. This is largely due to the fact that pylyzer is implemented in Rust. performance * Detailed analysis pylyzer can do more than the type checking. For example, it can detect out-of-bounds accesses to lists and accesses to nonexistent keys in dicts. analysis * Reports readability While pytype/pyright's error reports are illegible, pylyzer shows where the error occurred and provides clear error messages. pylyzer report pyright pyright_report * Rich LSP support pylyzer as a language server supports various features, such as completion and renaming (The language server is an adaptation of the Erg Language Server (ELS). For more information on the implemented features, please see here). lsp_support autoimport VSCode extension You can install the VSCode extension from the Marketplace or from the command line: code --install-extension pylyzer.pylyzer What is the difference from Ruff? Ruff, like pylyzer, is a static code analysis tool for Python written in Rust, but Ruff is a linter and pylyzer is a type checker & language server. pylyzer does not perform linting, and Ruff does not perform type checking. How it works pylyzer uses the type checker of the Erg programming language internally. This language is a transpiled language that targets Python, and has a static type system. pylyzer converts Python ASTs to Erg ASTs and passes them to Erg's type checker. It then displays the results with appropriate modifications. Limitations * pylyzer's type inspector only assumes (potentially) statically typed code, so you cannot check any code uses reflections, such as exec, setattr, etc. * pylyzer (= Erg's type system) has its own type declarations for the Python standard APIs. Typing of all APIs is not complete and may result in an error that such an API does not exist. * Since pylyzer's type checking is conservative, you may encounter many (possibly false positive) errors. We are working on fixing this, but if you are concerned about editor errors, please turn off the diagnostics feature. TODOs * [*] type checking + [*] variable + [*] operator + [*] function/method + [*] class * [*] type inference + [*] variable + [*] operator + [*] function/method + [*] class * [*] builtin modules resolving (partially) * [*] local scripts resolving * [ ] local packages resolving * [*] collection types + [*] list + [*] dict + [*] tuple * [ ] typing + [*] Union + [*] Optional + [*] Literal + [*] Callable + [ ] TypedDict + [ ] type variable (TypeVar, Generic) + [ ] Protocol + [ ] Final + [ ] Annotated + [ ] TypeAlias + [ ] type guard (TypeGuard) + [ ] others * collections.abc + [*] Iterable + [*] Iterator + [*] Mapping + [*] Sequence + [ ] others * [*] type assertion (typing.cast) * [*] type narrowing (is, isinstance) --------------------------------------------------------------------- ^1 The performance test was conducted on MacBook (Early 2016) with 1.1 GHz Intel Core m3 processor and 8 GB 1867 MHz LPDDR3 memory.- About A fast static code analyzer & language server for Python mtshiba.github.io/pylyzer/ Topics python rust language-server static-analysis type-checker Resources Readme License MIT license Activity Stars 1.5k stars Watchers 16 watching Forks 21 forks Report repository Releases 52 v0.0.51 Latest Dec 12, 2023 + 51 releases Sponsor this project Sponsor Learn more about GitHub Sponsors Contributors 3 * @mtshiba mtshiba Shunsuke Shibayama * @youknowone youknowone Jeong, YunWon * @FalkWoldmann FalkWoldmann Languages * Rust 87.3% * Python 6.5% * TypeScript 3.9% * JavaScript 1.1% * Shell 0.7% * PowerShell 0.5% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.