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 (stable) language features.

GitHub Releases

How to use

Check a single file

pylyzer file.py

Check multiple files

# glob patterns are supported
pylyzer file1.py file2.py dir/file*.py

Check an entire package

If you don't specify a file path, pylyzer will automatically search for the entry point.

pylyzer

Start the language server

This option is used when an LSP-aware editor requires arguments to start pylyzer.

pylyzer --server

For other options, check the manual.

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

  • Reports readability 📖

While pytype/pyright's error reports are illegible, pylyzer shows where the error occurred and provides clear error messages.

pyright

pyright_report

pylyzer 😃

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 & formatting, 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
    • async/await
    • user-defined abstract class
  • type inference
    • variable
    • operator
    • function/method
    • class
  • builtin modules analysis
  • local scripts analysis
  • local packages analysis
  • LSP features
    • diagnostics
    • completion
    • rename
    • hover
    • goto definition
    • signature help
    • find references
    • document symbol
    • call hierarchy
  • collection types
    • list
    • dict
    • tuple
    • set
  • typing
    • Union
    • Optional
    • Literal
    • Callable
    • Any
    • TypeVar
    • TypedDict
    • ClassVar
    • Generic
    • Protocol
    • Final
    • Annotated
    • TypeAlias
    • TypeGuard
    • type parameter syntax
    • type narrowing
    • others
  • collections.abc
    • Collection
    • Container
    • Generator
    • Iterable
    • Iterator
    • Mapping, MutableMapping
    • Sequence, MutableSequence
    • others
  • type assertion (typing.cast)
  • type narrowing (is, isinstance)
  • pyi (stub) files support
  • glob pattern file check
  • type comment (# type: ...)
  • virtual environment support
  • package manager support
    • pip
    • poetry
    • uv

Join us!

We are looking for contributors to help us improve pylyzer. If you are interested in contributing and have any questions, please feel free to contact us.


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


Release history Release notifications | RSS feed

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

If you're not sure about the file name format, learn more about wheel file names.

pylyzer-0.0.82-py3-none-win_amd64.whl (15.5 MB view details)

Uploaded Python 3Windows x86-64

pylyzer-0.0.82-py3-none-win32.whl (13.1 MB view details)

Uploaded Python 3Windows x86

pylyzer-0.0.82-py3-none-musllinux_1_2_x86_64.whl (13.5 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

pylyzer-0.0.82-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pylyzer-0.0.82-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (14.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

pylyzer-0.0.82-py3-none-macosx_11_0_arm64.whl (11.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file pylyzer-0.0.82-py3-none-win_amd64.whl.

File metadata

  • Download URL: pylyzer-0.0.82-py3-none-win_amd64.whl
  • Upload date:
  • Size: 15.5 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pylyzer-0.0.82-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 80b87c4e24724ef6d94e16e4d7fbe0922b366a77c8f2e88ad64e8d4cf4c70e83
MD5 0e363bd32569e891aab1d851d501cb33
BLAKE2b-256 10c3ab9da76ca458939c1da5fe2186b085c357b64f3526ee7f3f5f2670c11da3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylyzer-0.0.82-py3-none-win_amd64.whl:

Publisher: release.yml on mtshiba/pylyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylyzer-0.0.82-py3-none-win32.whl.

File metadata

  • Download URL: pylyzer-0.0.82-py3-none-win32.whl
  • Upload date:
  • Size: 13.1 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pylyzer-0.0.82-py3-none-win32.whl
Algorithm Hash digest
SHA256 919ba92368dd6c43236029c68ec4ab33e21ea62b8bda94c9c4c0f2569c61cf57
MD5 697db4696a96b3053f087b28a1d127e4
BLAKE2b-256 cee6c9bc99c3cbe643ceeefca9034a776a7901b2b9c1d739d14d4b9df3e5ea65

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylyzer-0.0.82-py3-none-win32.whl:

Publisher: release.yml on mtshiba/pylyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylyzer-0.0.82-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pylyzer-0.0.82-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1f0e6d81a291a2b8fa3b85403e4b8b704406e52c8b59025a5f84b885dc9e7f03
MD5 f3edc4778555f6615c7463858019511e
BLAKE2b-256 17f6e9ee045c0f16a445a73567edeb1093429b276f3783f0e9b92dce70a8b787

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylyzer-0.0.82-py3-none-musllinux_1_2_x86_64.whl:

Publisher: release.yml on mtshiba/pylyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylyzer-0.0.82-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pylyzer-0.0.82-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d409ec99edcfbdc38fb12cfb0f22ed4586775e5acff4df269dad1c1029c362f3
MD5 cf0ed542a121cf6f1875693c7e1eeb21
BLAKE2b-256 5697fbf47c8fd44e1988e3e072d58803ef2f139bcc61842842bfe5d34cc2cccd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylyzer-0.0.82-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on mtshiba/pylyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylyzer-0.0.82-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pylyzer-0.0.82-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 2e311b7cf132ebfe3d143e0c19efab9cf1b0628f921601e9794ab15073516fb6
MD5 55f9c404b16e57f441fda3c62e525454
BLAKE2b-256 ae9e2c1730bc3ba7725134cb260719952e06d740c885e36280b1c2d2f5924117

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylyzer-0.0.82-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on mtshiba/pylyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylyzer-0.0.82-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylyzer-0.0.82-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc2088c87de1d6e8813d356a7f7e42768976b8dc1416fd7fdf088630e757e7e5
MD5 63535e1f3863ac7108b19e7e8fa8f2ce
BLAKE2b-256 69cb684ea79840ea01fb4916d361732fd42ee169cf6a05ddcb79715fa35c0ff9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylyzer-0.0.82-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on mtshiba/pylyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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