summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pysnooz/default.nix
blob: 9c4d1def9175c096f84500c90c22121cc3d23789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
  lib,
  bleak,
  bleak-retry-connector,
  bluetooth-sensor-state-data,
  buildPythonPackage,
  events,
  fetchFromGitHub,
  freezegun,
  home-assistant-bluetooth,
  poetry-core,
  pytest-asyncio_0,
  pytest-cov-stub,
  pytest-mock,
  pytestCheckHook,
  transitions,
}:

buildPythonPackage rec {
  pname = "pysnooz";
  version = "0.10.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "AustinBrunkhorst";
    repo = "pysnooz";
    tag = "v${version}";
    hash = "sha256-jOXmaJprU35sdNRrBBx/YUyiDyyaE1qodWksXkTSEe0=";
  };

  patches = [
    # https://github.com/AustinBrunkhorst/pysnooz/pull/20
    ./bleak-compat.patch
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail 'transitions = "^0.8.11"' 'transitions = ">=0.8.11"' \
      --replace-fail 'Events = "^0.4"' 'Events = ">=0.4"'
  '';

  build-system = [ poetry-core ];

  dependencies = [
    bleak
    bleak-retry-connector
    bluetooth-sensor-state-data
    events
    home-assistant-bluetooth
    transitions
  ];

  nativeCheckInputs = [
    freezegun
    pytest-asyncio_0
    pytest-cov-stub
    pytest-mock
    pytestCheckHook
  ];

  pythonImportsCheck = [ "pysnooz" ];

  meta = {
    description = "Library to control SNOOZ white noise machines";
    homepage = "https://github.com/AustinBrunkhorst/pysnooz";
    changelog = "https://github.com/AustinBrunkhorst/pysnooz/blob/v${version}/CHANGELOG.md";
    license = with lib.licenses; [ mit ];
    maintainers = with lib.maintainers; [ fab ];
  };
}