summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/foobot-async/default.nix
blob: f06f046fb54ca6b996a9596f0a6c3a68c05b662f (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
{
  lib,
  buildPythonPackage,
  fetchPypi,
  aiohttp,
  async-timeout,
  aioresponses,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "foobot-async";
  version = "1.0.1";
  pyproject = true;

  src = fetchPypi {
    pname = "foobot_async";
    inherit version;
    hash = "sha256-QQjysk2m8QkOpLBdC8kfuoA9PcljgEwzKyrIAhxHB4c=";
  };

  postPatch = ''
    # https://github.com/reefab/foobot_async/issues/7
    substituteInPlace foobot_async/__init__.py \
      --replace-fail "with async_timeout.timeout" "async with async_timeout.timeout"
  '';

  build-system = [ setuptools ];

  dependencies = [
    aiohttp
    async-timeout
  ];

  nativeCheckInputs = [
    aioresponses
    pytestCheckHook
  ];

  pythonImportsCheck = [ "foobot_async" ];

  meta = {
    description = "API Client for Foobot Air Quality Monitoring devices";
    homepage = "https://github.com/reefab/foobot_async";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}