1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatchling,
6 hatch-vcs,
7 home-assistant,
8 python,
9}:
10
11buildPythonPackage rec {
12 pname = "homeassistant-stubs";
13 version = "2025.7.4";
14 pyproject = true;
15
16 disabled = python.version != home-assistant.python.version;
17
18 src = fetchFromGitHub {
19 owner = "KapJI";
20 repo = "homeassistant-stubs";
21 tag = version;
22 hash = "sha256-boOhdro11wbLHWVuJHHSuov8qxSiOCuaS8yfJgIRyJk=";
23 };
24
25 build-system = [
26 hatchling
27 hatch-vcs
28 home-assistant
29 ];
30
31 postPatch = ''
32 # Relax constraint to year and month
33 substituteInPlace pyproject.toml --replace-fail \
34 'homeassistant==${version}' \
35 'homeassistant~=${lib.versions.majorMinor home-assistant.version}'
36 '';
37
38 pythonImportsCheck = [
39 "homeassistant-stubs"
40 ];
41
42 doCheck = false;
43
44 meta = {
45 description = "Typing stubs for Home Assistant Core";
46 homepage = "https://github.com/KapJI/homeassistant-stubs";
47 changelog = "https://github.com/KapJI/homeassistant-stubs/releases/tag/${src.tag}";
48 license = lib.licenses.mit;
49 teams = [ lib.teams.home-assistant ];
50 };
51}