Closed4
静的型チェッカのPyreflyを使ってみる
Pyrefly: MetaがRustで作った高速な静的型チェッカ
とりあえずPyreflyを入れてみて
uv add pyrefly
uv sync
サンプルコードを書いて
def sample(hoge: str) -> None:
print(hoge)
sample(123)
チェックしてみると
uv run pyrefly check
以下の結果
INFO Found `/home/{user-name}/work/pyrefly-test/pyproject.toml` marking project root, checking root directory with default configuration
ERROR /home/{user-name}/work/pyrefly-test/main.py:4:8-11: Argument `Literal[123]` is not assignable to parameter `hoge` with type `str` in function `sample` [bad-argument-type]
INFO 1 errors shown, 0 errors ignored, 1 modules, 58 transitive dependencies, 17,356 lines, took 0.13s, peak memory physical 65.7 MiB
VS Codeのプラグインも入れてみた。
所感: 公式ドキュメントが読みやすい...。
このスクラップは3ヶ月前にクローズされました