From edb55ff54b9f81c0942f4120eedd72357d7b3d7c Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 7 Aug 2023 14:03:07 -0400 Subject: Working nixified python build This represents quite a few evenings of hacking. It doesn't build all of my Python code, because my Python code is not up to snuff, but it builds the examples and pulls in third party dependencies. Some design points: - I'm using buildPythonApplication in Builder.nix because it was getting way too annoying to wrap the Python script and set PYTHONPATH myself. Easier and more robust to just use the upstream nix builder - Because of this, I had to generate a setup.py. Maybe switch to pyproject.toml in the future, whatever. - Also because of this, Target.wrapper is becoming redundant. I'll just remove it when I get Guile built in nix. - Biz/Bild.nix is getting messy and could use a refactor. - In Builder.nix, I worked around the empty directories bug by just finding and deleting empty directories after unpacking. If its stupid but works it ain't stupid! - I had to touch __init__.py files in all directories before building. Annoying! - `repl` just works, which is awesome - To ensure good Python code, I moved lints and added type checking to the build. So I can't build anything unless it passes those checks. This seems restrictive, but if I want to run some non-passing code, I can still use `repl`, so it's actually not inhibitory. --- Biz/Lint.hs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'Biz/Lint.hs') diff --git a/Biz/Lint.hs b/Biz/Lint.hs index d44e465..d7db9d6 100644 --- a/Biz/Lint.hs +++ b/Biz/Lint.hs @@ -123,22 +123,6 @@ hlint = fixArgs = Nothing } -pylint :: Linter -pylint = - Linter - { exe = "pylint", - checkArgs = ["--disable=invalid-name"], - fixArgs = Nothing - } - -black :: Linter -black = - Linter - { exe = "black", - checkArgs = ["--check"], - fixArgs = Just [] - } - deadnix :: Linter deadnix = Linter @@ -180,7 +164,7 @@ runOne mode root cwd path_ = results +> traverse_ printResult >> results [ lint mode ormolu path_, lint mode hlint path_ ] - Just (Namespace _ Py) -> [lint mode pylint path_, lint mode black path_] + Just (Namespace _ Py) -> [] -- python linters are run in Builder.nix checkPhase Just (Namespace _ Sh) -> [lint mode shellcheck path_] Just (Namespace _ Nix) -> [lint mode deadnix path_] Just (Namespace _ Scm) -> [pure <| NoOp path_] -- cgit v1.2.3