1{ lib
2, aiohttp
3, aresponses
4, buildPythonPackage
5, certifi
6, fetchFromGitHub
7, fetchpatch
8, numpy
9, poetry-core
10, pygments
11, pysmb
12, pytest-aiohttp
13, pytest-asyncio
14, pytestCheckHook
15, pythonOlder
16}:
17
18buildPythonPackage rec {
19 pname = "pyairvisual";
20 version = "2023.08.1";
21 format = "pyproject";
22
23 disabled = pythonOlder "3.9";
24
25 src = fetchFromGitHub {
26 owner = "bachya";
27 repo = pname;
28 rev = "refs/tags/${version}";
29 hash = "sha256-+yqN3q+uA/v01uCguzUSoeCJK9lRmiiYn8d272+Dd2M=";
30 };
31
32 patches = [
33 # https://github.com/bachya/pyairvisual/pull/298
34 (fetchpatch {
35 name = "clean-up-build-dependencies.patch";
36 url = "https://github.com/bachya/pyairvisual/commit/eb32beb7229a53ff81917cc417ed66b26aae47dd.patch";
37 hash = "sha256-RLRbHmaR2A8MNc96WHx0L8ccyygoBUaOulAuRJkFuUM=";
38 })
39 ];
40
41 postPatch = ''
42 substituteInPlace pyproject.toml --replace \
43 'certifi = ">=2023.07.22"' \
44 'certifi = "*"'
45 '';
46
47 nativeBuildInputs = [
48 poetry-core
49 ];
50
51 propagatedBuildInputs = [
52 aiohttp
53 certifi
54 numpy
55 pygments
56 pysmb
57 ];
58
59 # this lets tests bind to localhost in sandbox mode on macOS
60 __darwinAllowLocalNetworking = true;
61
62 nativeCheckInputs = [
63 aresponses
64 pytest-aiohttp
65 pytest-asyncio
66 pytestCheckHook
67 pytestCheckHook
68 ];
69
70 disabledTestPaths = [
71 # Ignore the examples directory as the files are prefixed with test_.
72 "examples/"
73 ];
74
75 pythonImportsCheck = [
76 "pyairvisual"
77 ];
78
79 meta = with lib; {
80 description = "Python library for interacting with AirVisual";
81 homepage = "https://github.com/bachya/pyairvisual";
82 changelog = "https://github.com/bachya/pyairvisual/releases/tag/${version}";
83 license = with licenses; [ mit ];
84 maintainers = with maintainers; [ fab ];
85 };
86}