1{ lib
2, aiohttp
3, aresponses
4, buildPythonPackage
5, fetchFromGitHub
6, fetchpatch
7, poetry-core
8, pydantic
9, pytest-aiohttp
10, pytest-asyncio
11, pytestCheckHook
12, pythonOlder
13}:
14
15buildPythonPackage rec {
16 pname = "aiopurpleair";
17 version = "2022.12.1";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.9";
21
22 src = fetchFromGitHub {
23 owner = "bachya";
24 repo = pname;
25 rev = "refs/tags/${version}";
26 hash = "sha256-YmJH4brWkTpgzyHwu9UnIWrY5qlDCmMtvF+KxQFXwfk=";
27 };
28
29 patches = [
30 # This patch removes references to setuptools and wheel that are no longer
31 # necessary and changes poetry to poetry-core, so that we don't need to add
32 # unnecessary nativeBuildInputs.
33 #
34 # https://github.com/bachya/aiopurpleair/pull/207
35 #
36 (fetchpatch {
37 name = "clean-up-build-dependencies.patch";
38 url = "https://github.com/bachya/aiopurpleair/commit/8c704c51ea50da266f52a7f53198d29d643b30c5.patch";
39 hash = "sha256-RLRbHmaR2A8MNc96WHx0L8ccyygoBUaOulAuRJkFuUM=";
40 })
41 ];
42
43 postPatch = ''
44 substituteInPlace pyproject.toml \
45 --replace 'pydantic = "^1.10.2"' 'pydantic = "*"'
46 '';
47
48 nativeBuildInputs = [
49 poetry-core
50 ];
51
52 propagatedBuildInputs = [
53 aiohttp
54 pydantic
55 ];
56
57 __darwinAllowLocalNetworking = true;
58
59 nativeCheckInputs = [
60 aresponses
61 pytest-aiohttp
62 pytest-asyncio
63 pytestCheckHook
64 ];
65
66 disabledTestPaths = [
67 # Ignore the examples directory as the files are prefixed with test_.
68 "examples/"
69 ];
70
71 pythonImportsCheck = [
72 "aiopurpleair"
73 ];
74
75 meta = with lib; {
76 description = "Python library for interacting with the PurpleAir API";
77 homepage = "https://github.com/bachya/aiopurpleair";
78 changelog = "https://github.com/bachya/aiopurpleair/releases/tag/${version}";
79 license = with licenses; [ mit ];
80 maintainers = with maintainers; [ fab ];
81 };
82}