Skip to content

Commit 23eaadc

Browse files
authored
Merge pull request #28 from mweinelt/update-pre-commit
Add pyright to pre-commit hooks and some cleanup
2 parents 004bf01 + 4a1def7 commit 23eaadc

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,26 @@
2727
system:
2828
let
2929
pkgs = nixpkgs.legacyPackages.${system};
30+
lib = pkgs.lib;
31+
32+
pythonEnv = pkgs.home-assistant.python.withPackages (
33+
ps: with ps; [
34+
aiohttp
35+
(toPythonModule pkgs.home-assistant)
36+
voluptuous
37+
]
38+
);
3039
in
3140
{
3241
checks = {
3342
pre-commit = git-hooks.lib.${system}.run {
3443
src = ./.;
3544
hooks = {
3645
ruff.enable = true;
37-
ruff-format = {
46+
ruff-format.enable = true;
47+
pyright = {
3848
enable = true;
39-
pass_filenames = false;
49+
entry = "${lib.getExe pkgs.pyright} --pythonpath ${pythonEnv.interpreter}";
4050
};
4151
};
4252
};
@@ -46,17 +56,7 @@
4656
mkShell {
4757
inherit (self.checks.${system}.pre-commit) shellHook;
4858

49-
buildInputs =
50-
[
51-
isort
52-
pyright
53-
ruff
54-
]
55-
++ (with python312.pkgs; [
56-
aiohttp
57-
(toPythonModule pkgs.home-assistant)
58-
voluptuous
59-
]);
59+
buildInputs = [ pythonEnv ] ++ self.checks.${system}.pre-commit.enabledPackages;
6060
};
6161

6262
formatter = pkgs.nixfmt-rfc-style;

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[tool.ruff]
2+
target-version = "py313"
3+
14
[tool.ruff.lint]
25
select = ["I"]
36

0 commit comments

Comments
 (0)