Skip to main content

A static code analyzer & language server for Python

Project description

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

build from source

git clone https://github.com/mtshiba/pylyzer.git
cargo install --path . --locked

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pylyzer-0.0.54-pp310-pypy310_pp73-win_amd64.whl (12.6 MB view hashes)

Uploaded PyPy Windows x86-64

pylyzer-0.0.54-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

pylyzer-0.0.54-pp310-pypy310_pp73-macosx_11_0_arm64.whl (10.4 MB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

pylyzer-0.0.54-pp39-pypy39_pp73-win_amd64.whl (12.6 MB view hashes)

Uploaded PyPy Windows x86-64

pylyzer-0.0.54-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

pylyzer-0.0.54-pp39-pypy39_pp73-macosx_11_0_arm64.whl (10.4 MB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

pylyzer-0.0.54-pp38-pypy38_pp73-win_amd64.whl (12.6 MB view hashes)

Uploaded PyPy Windows x86-64

pylyzer-0.0.54-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

pylyzer-0.0.54-pp38-pypy38_pp73-macosx_11_0_arm64.whl (10.4 MB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

pylyzer-0.0.54-pp37-pypy37_pp73-win_amd64.whl (12.6 MB view hashes)

Uploaded PyPy Windows x86-64

pylyzer-0.0.54-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

pylyzer-0.0.54-cp312-cp312-win_amd64.whl (12.6 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

pylyzer-0.0.54-cp312-cp312-win32.whl (10.7 MB view hashes)

Uploaded CPython 3.12 Windows x86

pylyzer-0.0.54-cp312-cp312-musllinux_1_1_x86_64.whl (11.3 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

pylyzer-0.0.54-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

pylyzer-0.0.54-cp312-cp312-macosx_11_0_arm64.whl (10.4 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pylyzer-0.0.54-cp311-cp311-win_amd64.whl (12.6 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

pylyzer-0.0.54-cp311-cp311-win32.whl (10.7 MB view hashes)

Uploaded CPython 3.11 Windows x86

pylyzer-0.0.54-cp311-cp311-musllinux_1_1_x86_64.whl (11.3 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

pylyzer-0.0.54-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

pylyzer-0.0.54-cp311-cp311-macosx_11_0_arm64.whl (10.4 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pylyzer-0.0.54-cp310-cp310-win_amd64.whl (12.6 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

pylyzer-0.0.54-cp310-cp310-win32.whl (10.7 MB view hashes)

Uploaded CPython 3.10 Windows x86

pylyzer-0.0.54-cp310-cp310-musllinux_1_1_x86_64.whl (11.3 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

pylyzer-0.0.54-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

pylyzer-0.0.54-cp310-cp310-macosx_11_0_arm64.whl (10.4 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pylyzer-0.0.54-cp39-cp39-win_amd64.whl (12.6 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

pylyzer-0.0.54-cp39-cp39-win32.whl (10.7 MB view hashes)

Uploaded CPython 3.9 Windows x86

pylyzer-0.0.54-cp39-cp39-musllinux_1_1_x86_64.whl (11.3 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

pylyzer-0.0.54-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

pylyzer-0.0.54-cp39-cp39-macosx_11_0_arm64.whl (10.4 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pylyzer-0.0.54-cp38-cp38-win_amd64.whl (12.6 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

pylyzer-0.0.54-cp38-cp38-win32.whl (10.7 MB view hashes)

Uploaded CPython 3.8 Windows x86

pylyzer-0.0.54-cp38-cp38-musllinux_1_1_x86_64.whl (11.3 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

pylyzer-0.0.54-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (12.5 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

pylyzer-0.0.54-cp38-cp38-macosx_11_0_arm64.whl (10.3 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pylyzer-0.0.54-cp37-cp37m-win_amd64.whl (12.6 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

pylyzer-0.0.54-cp37-cp37m-win32.whl (10.6 MB view hashes)

Uploaded CPython 3.7m Windows x86

pylyzer-0.0.54-cp37-cp37m-musllinux_1_1_x86_64.whl (11.2 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

pylyzer-0.0.54-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pylyzer-0.0.54-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (12.4 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page