-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployed 6dc6705 with MkDocs version: 1.6.0
- Loading branch information
Showing
4 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"pylyzer \u26a1","text":"<p><code>pylyzer</code> is a static code analyzer / language server for Python, written in Rust.</p>"},{"location":"#installation","title":"Installation","text":""},{"location":"#pip","title":"pip","text":"<pre><code>pip install pylyzer\n</code></pre>"},{"location":"#cargo-rust-package-manager","title":"cargo (Rust package manager)","text":"<pre><code>cargo install pylyzer --locked\n</code></pre>"},{"location":"#build-from-source","title":"build from source","text":"<pre><code>git clone https://github.com/mtshiba/pylyzer.git\ncargo install --path . --locked\n</code></pre> <p>Make sure that <code>cargo</code>/<code>rustc</code> is up-to-date, as pylyzer may be written with the latest (stable) language features.</p>"},{"location":"#github-releases","title":"GitHub Releases","text":""},{"location":"#what-is-the-advantage-over-pylint-pyright-pytype-etc","title":"What is the advantage over pylint, pyright, pytype, etc.?","text":"<ul> <li>Performance \ud83c\udf1f</li> </ul> <p>On average, pylyzer can inspect Python scripts more than 100 times faster than pytype and pyright <sup>1</sup>. This is largely due to the fact that pylyzer is implemented in Rust.</p> <p></p> <ul> <li>Reports readability \ud83d\udcd6</li> </ul> <p>While pytype/pyright's error reports are illegible, pylyzer shows where the error occurred and provides clear error messages.</p>"},{"location":"#pyright","title":"pyright","text":""},{"location":"#pylyzer_1","title":"pylyzer \ud83d\ude03","text":"<ul> <li>Rich LSP support \ud83d\udcdd</li> </ul> <p>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).</p> <p></p> <p></p>"},{"location":"#vscode-extension","title":"VSCode extension","text":"<p>You can install the VSCode extension from the Marketplace or from the command line:</p> <pre><code>code --install-extension pylyzer.pylyzer\n</code></pre>"},{"location":"#what-is-the-difference-from-ruff","title":"What is the difference from Ruff?","text":"<p>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.</p>"},{"location":"#how-it-works","title":"How it works","text":"<p>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.</p> <p>pylyzer converts Python ASTs to Erg ASTs and passes them to Erg's type checker. It then displays the results with appropriate modifications.</p>"},{"location":"#limitations","title":"Limitations","text":"<ul> <li> <p>pylyzer's type inspector only assumes (potentially) statically typed code, so you cannot check any code uses reflections, such as <code>exec</code>, <code>setattr</code>, etc.</p> </li> <li> <p>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.</p> </li> <li> <p>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.</p> </li> </ul>"},{"location":"#todos","title":"TODOs","text":"<ul> <li> type checking<ul> <li> variable</li> <li> operator</li> <li> function/method</li> <li> class</li> </ul> </li> <li> type inference<ul> <li> variable</li> <li> operator</li> <li> function/method</li> <li> class</li> </ul> </li> <li> builtin modules analysis</li> <li> local scripts analysis</li> <li> local packages analysis</li> <li> LSP features<ul> <li> diagnostics</li> <li> completion</li> <li> rename</li> <li> hover</li> <li> goto definition</li> <li> signature help</li> <li> find references</li> <li> document symbol</li> <li> call hierarchy</li> </ul> </li> <li> collection types<ul> <li> <code>list</code></li> <li> <code>dict</code></li> <li> <code>tuple</code></li> <li> <code>set</code></li> </ul> </li> <li> <code>typing</code><ul> <li> <code>Union</code></li> <li> <code>Optional</code></li> <li> <code>Literal</code></li> <li> <code>Callable</code></li> <li> <code>TypedDict</code></li> <li> <code>TypeVar</code></li> <li> <code>Generic</code></li> <li> <code>Protocol</code></li> <li> <code>Final</code></li> <li> <code>Annotated</code></li> <li> <code>TypeAlias</code></li> <li> <code>TypeGuard</code></li> <li> type parameter syntax</li> <li> type narrowing</li> <li> others</li> </ul> </li> <li> <code>collections.abc</code><ul> <li> <code>Iterable</code></li> <li> <code>Iterator</code></li> <li> <code>Mapping</code></li> <li> <code>Sequence</code></li> <li> others</li> </ul> </li> <li> type assertion (<code>typing.cast</code>)</li> <li> type narrowing (<code>is</code>, <code>isinstance</code>)</li> <li> <code>pyi</code> (stub) files support</li> <li> glob pattern file check</li> </ul>"},{"location":"#join-us","title":"Join us!","text":"<p>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.</p> <ul> <li>Discord (Erg language)<ul> <li>#pylyzer</li> </ul> </li> <li>GitHub discussions</li> </ul> <p><sup>1</sup> The performance test was conducted on MacBook (Early 2016) with 1.1 GHz Intel Core m3 processor and 8 GB 1867 MHz LPDDR3 memory.\u21a9</p>"},{"location":"editor/","title":"Editor integrations","text":""},{"location":"editor/#vscode","title":"VSCode","text":"<ul> <li>Install the extension.</li> </ul>"},{"location":"editor/#neovim","title":"Neovim","text":"<ul> <li>Setup mason.</li> <li>Type <code>:MasonInstall pylyzer</code> in Neovim.</li> </ul> <p>If you use LunarVim, no setup is required. Just install pylyzer and you are good to go.</p>"},{"location":"errors/errors/","title":"Pylyzer-specific errors","text":""},{"location":"errors/errors/#e0001-reassignment-of-a-function-referenced-by-other-functions","title":"E0001: Reassignment of a function referenced by other functions","text":"<pre><code>def g(): return f()\n\ndef f(): return 1\ndef f(): return \"a\" # E0001: Reassignment of a function referenced by other functions\n\nprint(g())\n</code></pre>"},{"location":"errors/errors/#e0002-__init__-doesnt-have-a-first-parameter-named-self","title":"E0002: <code>__init__</code> doesn't have a first parameter named <code>self</code>","text":"<pre><code>class C:\n def __init__(a): pass # E0002\n</code></pre>"},{"location":"errors/errors/#e0003-__init__-as-a-member-variable","title":"E0003: <code>__init__</code> as a member variable","text":"<pre><code>class C:\n __init__ = 1 # E0003\n</code></pre>"},{"location":"errors/warns/","title":"Pylyzer-specific warnings","text":""},{"location":"errors/warns/#w0188-used-value","title":"W0188: Used value","text":"<pre><code>def f(x): return x\n\nf(1) # W0188: UnusedWarning: the evaluation result of the expression (: {1, }) is not used\n</code></pre>"},{"location":"options/options/","title":"command line options","text":""},{"location":"options/options/#-server","title":"--server","text":"<p>Launch as a language server.</p>"},{"location":"options/options/#-dump-decl","title":"--dump-decl","text":"<p>Dump a type declarations file (d.er) after type checking.</p> <pre><code>$ pylyzer --dump-decl test.py\nStart checking: test.py\nAll checks OK: test.py\n\n$ ls\ntest.py test.d.er\n</code></pre>"},{"location":"options/options/#-c-code","title":"-c/--code","text":"<p>Check code from the command line.</p> <pre><code>$ pylyzer -c \"print('hello world')\"\nStart checking: string\nAll checks OK: string\n</code></pre>"},{"location":"options/pyproject/","title":"<code>pyproject.toml</code> options","text":""},{"location":"options/pyproject/#toolpylyzerpythonpath","title":"<code>tool.pylyzer.python.path</code>","text":"<p>Path to the Python interpreter to use. If not set, the default Python interpreter will be used.</p> <pre><code>[tool.pylyzer.python]\npath = \"path/to/python\"\n</code></pre>"}]} | ||
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"pylyzer \u26a1","text":"<p><code>pylyzer</code> is a static code analyzer / language server for Python, written in Rust.</p>"},{"location":"#installation","title":"Installation","text":""},{"location":"#pip","title":"pip","text":"<pre><code>pip install pylyzer\n</code></pre>"},{"location":"#cargo-rust-package-manager","title":"cargo (Rust package manager)","text":"<pre><code>cargo install pylyzer --locked\n</code></pre>"},{"location":"#build-from-source","title":"build from source","text":"<pre><code>git clone https://github.com/mtshiba/pylyzer.git\ncargo install --path . --locked\n</code></pre> <p>Make sure that <code>cargo</code>/<code>rustc</code> is up-to-date, as pylyzer may be written with the latest (stable) language features.</p>"},{"location":"#github-releases","title":"GitHub Releases","text":""},{"location":"#what-is-the-advantage-over-pylint-pyright-pytype-etc","title":"What is the advantage over pylint, pyright, pytype, etc.?","text":"<ul> <li>Performance \ud83c\udf1f</li> </ul> <p>On average, pylyzer can inspect Python scripts more than 100 times faster than pytype and pyright <sup>1</sup>. This is largely due to the fact that pylyzer is implemented in Rust.</p> <p></p> <ul> <li>Reports readability \ud83d\udcd6</li> </ul> <p>While pytype/pyright's error reports are illegible, pylyzer shows where the error occurred and provides clear error messages.</p>"},{"location":"#pyright","title":"pyright","text":""},{"location":"#pylyzer_1","title":"pylyzer \ud83d\ude03","text":"<ul> <li>Rich LSP support \ud83d\udcdd</li> </ul> <p>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).</p> <p></p> <p></p>"},{"location":"#vscode-extension","title":"VSCode extension","text":"<p>You can install the VSCode extension from the Marketplace or from the command line:</p> <pre><code>code --install-extension pylyzer.pylyzer\n</code></pre>"},{"location":"#what-is-the-difference-from-ruff","title":"What is the difference from Ruff?","text":"<p>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.</p>"},{"location":"#how-it-works","title":"How it works","text":"<p>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.</p> <p>pylyzer converts Python ASTs to Erg ASTs and passes them to Erg's type checker. It then displays the results with appropriate modifications.</p>"},{"location":"#limitations","title":"Limitations","text":"<ul> <li> <p>pylyzer's type inspector only assumes (potentially) statically typed code, so you cannot check any code uses reflections, such as <code>exec</code>, <code>setattr</code>, etc.</p> </li> <li> <p>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.</p> </li> <li> <p>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.</p> </li> </ul>"},{"location":"#todos","title":"TODOs","text":"<ul> <li> type checking<ul> <li> variable</li> <li> operator</li> <li> function/method</li> <li> class</li> </ul> </li> <li> type inference<ul> <li> variable</li> <li> operator</li> <li> function/method</li> <li> class</li> </ul> </li> <li> builtin modules analysis</li> <li> local scripts analysis</li> <li> local packages analysis</li> <li> LSP features<ul> <li> diagnostics</li> <li> completion</li> <li> rename</li> <li> hover</li> <li> goto definition</li> <li> signature help</li> <li> find references</li> <li> document symbol</li> <li> call hierarchy</li> </ul> </li> <li> collection types<ul> <li> <code>list</code></li> <li> <code>dict</code></li> <li> <code>tuple</code></li> <li> <code>set</code></li> </ul> </li> <li> <code>typing</code><ul> <li> <code>Union</code></li> <li> <code>Optional</code></li> <li> <code>Literal</code></li> <li> <code>Callable</code></li> <li> <code>TypedDict</code></li> <li> <code>TypeVar</code></li> <li> <code>Generic</code></li> <li> <code>Protocol</code></li> <li> <code>Final</code></li> <li> <code>Annotated</code></li> <li> <code>TypeAlias</code></li> <li> <code>TypeGuard</code></li> <li> type parameter syntax</li> <li> type narrowing</li> <li> others</li> </ul> </li> <li> <code>collections.abc</code><ul> <li> <code>Iterable</code></li> <li> <code>Iterator</code></li> <li> <code>Mapping</code></li> <li> <code>Sequence</code></li> <li> others</li> </ul> </li> <li> type assertion (<code>typing.cast</code>)</li> <li> type narrowing (<code>is</code>, <code>isinstance</code>)</li> <li> <code>pyi</code> (stub) files support</li> <li> glob pattern file check</li> </ul>"},{"location":"#join-us","title":"Join us!","text":"<p>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.</p> <ul> <li>Discord (Erg language)<ul> <li>#pylyzer</li> </ul> </li> <li>GitHub discussions</li> </ul> <p><sup>1</sup> The performance test was conducted on MacBook (Early 2016) with 1.1 GHz Intel Core m3 processor and 8 GB 1867 MHz LPDDR3 memory.\u21a9</p>"},{"location":"editor/","title":"Editor integrations","text":""},{"location":"editor/#vscode","title":"VSCode","text":"<ul> <li>Install the extension.</li> </ul>"},{"location":"editor/#neovim","title":"Neovim","text":"<ul> <li>Setup mason.</li> <li>Type <code>:MasonInstall pylyzer</code> in Neovim.</li> </ul> <p>If you use LunarVim, no setup is required. Just install pylyzer and you are good to go.</p>"},{"location":"errors/errors/","title":"Pylyzer-specific errors","text":""},{"location":"errors/errors/#e0001-reassignment-of-a-function-referenced-by-other-functions","title":"E0001: Reassignment of a function referenced by other functions","text":"<pre><code>def g(): return f()\n\ndef f(): return 1\ndef f(): return \"a\" # E0001: Reassignment of a function referenced by other functions\n\nprint(g())\n</code></pre>"},{"location":"errors/errors/#e0002-__init__-doesnt-have-a-first-parameter-named-self","title":"E0002: <code>__init__</code> doesn't have a first parameter named <code>self</code>","text":"<pre><code>class C:\n def __init__(a): pass # E0002\n</code></pre>"},{"location":"errors/errors/#e0003-__init__-as-a-member-variable","title":"E0003: <code>__init__</code> as a member variable","text":"<pre><code>class C:\n __init__ = 1 # E0003\n</code></pre>"},{"location":"errors/warns/","title":"Pylyzer-specific warnings","text":""},{"location":"errors/warns/#w0188-used-value","title":"W0188: Used value","text":"<pre><code>def f(x): return x\n\nf(1) # W0188: UnusedWarning: the evaluation result of the expression (: {1, }) is not used\n</code></pre>"},{"location":"options/options/","title":"command line options","text":""},{"location":"options/options/#-server","title":"--server","text":"<p>Launch as a language server.</p>"},{"location":"options/options/#-dump-decl","title":"--dump-decl","text":"<p>Dump a type declarations file (d.er) after type checking.</p> <pre><code>$ pylyzer --dump-decl test.py\nStart checking: test.py\nAll checks OK: test.py\n\n$ ls\ntest.py test.d.er\n</code></pre>"},{"location":"options/options/#-c-code","title":"-c/--code","text":"<p>Check code from the command line.</p> <pre><code>$ pylyzer -c \"print('hello world')\"\nStart checking: string\nAll checks OK: string\n</code></pre>"},{"location":"options/options/#-disable","title":"--disable","text":"<p>Disable a default LSP feature. Default (disableable) features are:</p> <ul> <li>codeAction</li> <li>codeLens</li> <li>completion</li> <li>diagnostics</li> <li>findReferences</li> <li>gotoDefinition</li> <li>hover</li> <li>inlayHint</li> <li>rename</li> <li>semanticTokens</li> <li>signatureHelp</li> </ul>"},{"location":"options/pyproject/","title":"<code>pyproject.toml</code> options","text":""},{"location":"options/pyproject/#toolpylyzerpythonpath","title":"<code>tool.pylyzer.python.path</code>","text":"<p>Path to the Python interpreter to use. If not set, the default Python interpreter will be used.</p> <pre><code>[tool.pylyzer.python]\npath = \"path/to/python\"\n</code></pre>"}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.