Package: rust-python-linter
rust-python-linterA performance-focused,Pyflakes-inspired Python linter, written
in Rust.Features:Python 3.10 compatibilityESLint-inspired cache semanticsTypeScript-inspired--watchsemanticspyproject.tomlsupportInstallationAvailable asrust-python-linteron PyPI:pipinstallrust-python-linterUsageTo run the linter, try any of the following:rust_python_linterpath/to/code/to/check.py# ...or...rust_python_linterpath/to/code/# ...or...rust_python_linterpath/to/code/*.pyYou can also run in--watchmode to automatically re-run the linter on-change with, e.g.:rust_python_linterpath/to/code/--watchDevelopmentAs the name suggests,rust-python-linteris implemented in Rust:cargofmt
cargoclippy
cargorunresources/test/srcDeploymentrust-python-linteris released for Python usingmaturin:maturinpublish--skip-existing--targetx86_64-apple-darwin
maturinpublish--skip-existing--targetaarch64-apple-darwinBenchmarkingFirst, cloneCPython. It's a large and diverse Python codebase,
which makes it a good target for benchmarking. Note that we clone v3.9, asRustPythondoesn't yet
support pattern matching, which was introduced in v3.10.gitclone--branch3.9https://github.com/python/cpython.gitresources/test/cpythonAdd thispyproject.tomlto the directory:[tool.linter]line-length=88exclude=["Lib/ctypes/test/test_numbers.py","Lib/dataclasses.py","Lib/lib2to3/tests/data/bom.py","Lib/lib2to3/tests/data/crlf.py","Lib/lib2to3/tests/data/different_encoding.py","Lib/lib2to3/tests/data/false_encoding.py","Lib/lib2to3/tests/data/py2_test_grammar.py","Lib/sqlite3/test/factory.py","Lib/sqlite3/test/hooks.py","Lib/sqlite3/test/regression.py","Lib/sqlite3/test/transactions.py","Lib/sqlite3/test/types.py","Lib/test/bad_coding2.py","Lib/test/badsyntax_3131.py","Lib/test/badsyntax_pep3120.py","Lib/test/encoded_modules/module_iso_8859_1.py","Lib/test/encoded_modules/module_koi8_r.py","Lib/test/sortperf.py","Lib/test/test_email/torture_test.py","Lib/test/test_fstring.py","Lib/test/test_genericpath.py","Lib/test/test_getopt.py","Lib/test/test_htmlparser.py","Lib/test/test_importlib/stubs.py","Lib/test/test_importlib/test_files.py","Lib/test/test_importlib/test_metadata_api.py","Lib/test/test_importlib/test_open.py","Lib/test/test_importlib/test_util.py","Lib/test/test_named_expressions.py","Lib/test/test_peg_generator/__main__.py","Lib/test/test_pipes.py","Lib/test/test_source_encoding.py","Lib/test/test_weakref.py","Lib/test/test_webbrowser.py","Lib/tkinter/__main__.py","Lib/tkinter/test/test_tkinter/test_variables.py","Modules/_decimal/libmpdec/literature/fnt.py","Modules/_decimal/tests/deccheck.py","Tools/i18n/pygettext.py","Tools/test2to3/maintest.py","Tools/test2to3/setup.py","Tools/test2to3/test/test_foo.py","Tools/test2to3/test2to3/hello.py",]Next, to benchmark the release build:cargobuild--release

hyperfine--warmup5\"./target/release/rust_python_linter ./resources/test/cpython/ --no-cache"\"./target/release/rust_python_linter ./resources/test/cpython/"Benchmark1:./target/release/rust_python_linter./resources/test/cpython/--no-cacheTime(mean±σ):353.6ms±7.6ms[User:2868.8ms,System:171.5ms]Range(min…max):344.4ms…367.3ms10runs

Benchmark2:./target/release/rust_python_linter./resources/test/cpython/Time(mean±σ):59.6ms±2.5ms[User:36.4ms,System:345.6ms]Range(min…max):55.9ms…67.0ms48runs