Add mypy to python flake

This commit is contained in:
xenia 2024-01-06 19:29:52 +01:00
parent 51acaa3904
commit 60d813c804
3 changed files with 13 additions and 2 deletions

1
python/.gitignore vendored
View File

@ -1 +1,2 @@
.direnv
.mypy_cache

View File

@ -9,11 +9,16 @@
flake-utils.lib.eachDefaultSystem (sys:
let pkgs = nixpkgs.legacyPackages.${sys};
python = pkgs.python310.withPackages (ps: with ps; [
matplotlib
ipython
pylsp-mypy
]);
cfg = ./mypy-config.ini;
in rec {
devShells.default = python;
packages.tychk-watch = pkgs.writeScriptBin "tychk" "echo 'running mypy on change...' ; ${pkgs.watchexec}/bin/watchexec -e py ${python}/bin/mypy --config ${cfg} ${./.}";
packages.tychk = pkgs.writeScriptBin "tychk" "${python}/bin/mypy ${./.} --config ${cfg}";
devShells.default = pkgs.mkShell {
packages = [ python ];
};
}
);
}

5
python/mypy-config.ini Normal file
View File

@ -0,0 +1,5 @@
[mypy]
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True