A fast static code analyzer & language server for Python

Overview

pylyzer

vsm-version Build status Build status

pylyzer is a static code analyzer / language server for Python written in Rust.

Installation

cargo (rust package manager)

cargo install pylyzer

pip

pip install pylyzer

If installed this way, type resolution for the standard libraries is not available. If you want to use it, you need to install Erg.

curl -L https://github.com/mtshiba/ergup/raw/main/ergup.py | python3

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

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.

  • Type checking of compound types such as Union types is not supported yet (will be implemented soon).

  • 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.

TODOs

  • type checking
    • variable
    • operator
    • function/method
    • class
  • type inferring
    • variable
    • operator
    • function/method
    • class
  • builtin modules resolving (partially)
  • local scripts resolving
  • local packages resolving
  • compound type checking
  • type assertion

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.

You might also like...
Rust Imaging Library's Python binding: A performant and high-level image processing library for Python written in Rust

ril-py Rust Imaging Library for Python: Python bindings for ril, a performant and high-level image processing library written in Rust. What's this? Th

TinyTodo is a Cedar Agent example, with a server in Rust and client in python
TinyTodo is a Cedar Agent example, with a server in Rust and client in python

TinyTodo - OPAL and Cedar Agent Demo TinyTodo is a simple application for managing task lists. It uses OPAL and Cedar Agent to control who has access

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code. It accepts a local path to a folder containing code, and generates a review for each file in the folder and its subdirectories.

My solutions for the Advent of Code 2021 in Scala, Python, Haskell and Rust.

Advent of Code 2021 These are my Advent of Code 2021 solutions written in Scala 3, Haskell, Python and Rust. Day Title L1 L2 L3 L4 01 Sonar Sweep Scal

A toy example showing how to run Rust code in Python for speed and progress.

PoC: Integrating Rust in Python A toy example showing how to run Rust code in Python for speed and progress. Requirements Python 3.6+ Rust 1.44+ Cargo

Demo app duplicated in 5 languages (Go/JavaScript/Python/Ruby/Rust) showing how to go from source code to container image using melange+apko

hello-melange-apko 💫 This repo contains an example app duplicated across 5 languages showing how to: Package source code into APKs using melange Buil

Fast DNA manipulation for Python, written in Rust.

quickdna Quickdna is a simple, fast library for working with DNA sequences. It is up to 100x faster than Biopython for some translation tasks, in part

🐎 A fast implementation of the Aho-Corasick algorithm using the compact double-array data structure. (Python wrapper for daachorse)

python-daachorse daachorse is a fast implementation of the Aho-Corasick algorithm using the compact double-array data structure. This is a Python wrap

A fast python geohash library created by wrapping rust.

Pygeohash-Fast A Fast geohasher for python. Created by wrapping the rust geohash crate with pyo3. Huge shout out to the georust community :) Currently

Releases(v0.0.3)
Owner
Shunsuke Shibayama
Majoring in Physics. Interested in quantum dynamics & programming languages.
Shunsuke Shibayama
A device-tree source parser, analyzer and language server.

Ginko A device-tree source parser, analyzer and language server. The main goal of this project is to make working with device-trees easy. For example,

Lukas Scheller 4 Feb 28, 2024
A simple, fast, and easy to use static file server

Warning This is still in early development, I would not recommend for production use.. yet. See the issues for things that are on the "roadmap" or mis

Ayodeji O. 5 Feb 26, 2024
Language server for Odoo Python/JS/XML

odoo-lsp Features Completion, definition and references for models, XML IDs and model fields Works for records, templates, env.ref() and other structu

Viet Dinh 5 Aug 31, 2023
dua (-> Disk Usage Analyzer) is a tool to conveniently learn about the usage of disk space of a given directory

dua (-> Disk Usage Analyzer) is a tool to conveniently learn about the usage of disk space of a given directory. It's parallel by default and will max

Sebastian Thiel 1.8k Jan 2, 2023
Hashlink bytecode disassembler, analyzer, decompiler and assembler.

Hashlink bytecode This repository contains a collection of Rust crates and cli tools to load, disassemble, decompile and analyze Hashlink bytecode. Re

Guillaume Anthouard 24 Dec 21, 2022
High-Speed Memory Scanner & Analyzer with REST API.

memory-server High-Speed Memory Scanner & Analyzer with REST API. Usage iOS Jailbreaking of iphone is required. Place your PC and iphone in the same n

Kenjiro Ichise 8 Jul 12, 2023
PyO3 bindings and Python interface to skani, a method for fast fast genomic identity calculation using sparse chaining.

?? ⛓️ ?? Pyskani PyO3 bindings and Python interface to skani, a method for fast fast genomic identity calculation using sparse chaining. ??️ Overview

Martin Larralde 13 Mar 21, 2023
Simple Secure Static (HTTPS) File Server with embedded certificate

Secure Static File Server Static Files HTTPs server with self signed embedded certificate Installation Install using cargo: cargo install ssfs Or buil

0xor0ne 21 Apr 20, 2023
A file server that supports static serving, uploading, searching, accessing control, webdav...

Dufs Dufs is a distinctive utility file server that supports static serving, uploading, searching, accessing control, webdav... Features Serve static

null 3.6k Oct 30, 2023
Sero is a web server that allows you to easily host your static sites without pain. The idea was inspired by surge.sh but gives you full control.

sero Lightning-fast, static web publishing with zero configuration and full control ?? Table Of Contents ?? Table Of Contents ?? Tools ❓ About The Pro

Dmitry Miasnenko 6 Nov 13, 2023