From 544d75a47e85d2b334267a43ba065bb69538ad75 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 7 Apr 2024 14:49:45 -0400 Subject: Add mypy to Python REPL I tried to add it to Lint.hs but I can't because mypy needs the target's external libraries in its environment to load and check the types for that dependency. So instead, I just added a function to the REPL environment that runs the type checker. I already had mypy in the REPL environment so I must have started down this path before and just didn't add the REPL tooling. The automatic typechecking on load feels like Haskell. A previous version of this patch had just provided a `typecheck()` function to the REPL, but it felt awkward to type all that out just to check my code after loading it. I would like to bind a key like ctrl-r or alt-r to the `reload()` function, but I'm not sure how to do that. I think Python uses GNU readline so there should be some docs, but a first pass search didn't find what I needed. --- Biz/Ide/repl.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'Biz/Ide') diff --git a/Biz/Ide/repl.sh b/Biz/Ide/repl.sh index 8b28dcd..1aca862 100755 --- a/Biz/Ide/repl.sh +++ b/Biz/Ide/repl.sh @@ -69,7 +69,6 @@ fi ;; Py) langdeps+=("mypy") - flags+=(--packages ruff) flags+=(--packages "$BILD.bild.python.pythonWith (p: with p; [${langdeps[*]}])") PYTHONPATH=$CODEROOT:$PYTHONPATH pycommand="python -i $CODEROOT/Biz/Repl.py $module ${targets[*]}" -- cgit v1.2.3