pylyzer

所属分类:Python编程
开发工具:Rust
文件大小:0KB
下载次数:0
上传日期:2023-08-24 06:01:04
上 传 者sh-1993
说明:  用于Python的快速静态代码分析器和语言服务器,
(A fast static code analyzer & language server for Python,)

文件列表:
.cargo/ (0, 2023-12-11)
.cargo/config.toml (292, 2023-12-11)
.pre-commit-config.yaml (559, 2023-12-11)
.vscode/ (0, 2023-12-11)
.vscode/settings.json (132, 2023-12-11)
Cargo.lock (24515, 2023-12-11)
Cargo.toml (2426, 2023-12-11)
LICENSE (1036, 2023-12-11)
cargo_publish.ps1 (737, 2023-12-11)
cargo_publish.sh (753, 2023-12-11)
crates/ (0, 2023-12-11)
crates/py2erg/ (0, 2023-12-11)
crates/py2erg/Cargo.toml (545, 2023-12-11)
crates/py2erg/ast_util.rs (326, 2023-12-11)
crates/py2erg/convert.rs (91137, 2023-12-11)
crates/py2erg/error.rs (2703, 2023-12-11)
crates/py2erg/gen_decl.rs (5767, 2023-12-11)
crates/py2erg/lib.rs (98, 2023-12-11)
docs/ (0, 2023-12-11)
docs/assets/ (0, 2023-12-11)
docs/assets/pylyzer-logo.png (11203, 2023-12-11)
docs/assets/pylyzer-logo.svg (3781, 2023-12-11)
docs/editor.md (365, 2023-12-11)
docs/source/ (0, 2023-12-11)
docs/source/errors.md (462, 2023-12-11)
docs/source/options.md (399, 2023-12-11)
docs/source/warns.md (176, 2023-12-11)
extension/ (0, 2023-12-11)
extension/.vscode/ (0, 2023-12-11)
extension/.vscode/extensions.json (68, 2023-12-11)
extension/.vscode/launch.json (540, 2023-12-11)
extension/.vscode/tasks.json (753, 2023-12-11)
... ...

# pylyzer ![pylyzer_logo_with_letters](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/pylyzer-logo-with-letters.png) vsm-version Build status Build status `pylyzer` is a static code analyzer / language server for Python, written in Rust. ## Installation ### pip ```bash pip install pylyzer ``` ### cargo (rust package manager) ```bash cargo install pylyzer --locked ``` ### build from source ```bash 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](https://github.com/mtshiba/pylyzer/releases/latest) ## 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](#1). This is largely due to the fact that pylyzer is implemented in Rust. ![performance](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/performance.png) * 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](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/analysis.png) * Reports readability While pytype/pyright's error reports are illegible, pylyzer shows where the error occurred and provides clear error messages. ### pylyzer ![report](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/report.png) ### pyright ![pyright_report](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/pyright_report.png) * 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](https://github.com/erg-lang/erg/tree/main/crates/els#readme)). ![lsp_support](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/lsp_support.png) ![autoimport](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/autoimport.gif) ## VSCode extension You can install the VSCode extension from the [Marketplace](https://marketplace.visualstudio.com/items?itemName=pylyzer.pylyzer) or from the command line: ```sh code --install-extension pylyzer.pylyzer ``` ## What is the difference from [Ruff](https://github.com/charliermarsh/ruff)? [Ruff](https://github.com/charliermarsh/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](https://erg-lang.org) 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 * [x] type checking * [x] variable * [x] operator * [x] function/method * [x] class * [x] type inference * [x] variable * [x] operator * [x] function/method * [x] class * [x] builtin modules resolving (partially) * [x] local scripts resolving * [ ] local packages resolving * [x] collection types * [x] `list` * [x] `dict` * [x] `tuple` * [ ] `typing` * [x] `Union` * [x] `Optional` * [x] `Literal` * [x] `Callable` * [ ] `TypedDict` * [ ] type variable (`TypeVar`, `Generic`) * [ ] `Protocol` * [ ] `Final` * [ ] `Annotated` * [ ] `TypeAlias` * [ ] type guard (`TypeGuard`) * [ ] others * `collections.abc` * [x] `Iterable` * [x] `Iterator` * [x] `Mapping` * [x] `Sequence` * [ ] others * [x] type assertion (`typing.cast`) * [x] 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.[](#f1)

近期下载者

相关文件


收藏者