1{ lib
2, buildPythonPackage
3, fetchPypi
4, pkgs
5, setuptools
6, aiofiles
7, click
8, coverage
9, tomli
10, pytest
11, pytest-mock
12, pytest-asyncio
13, pytestCheckHook
14, pythonOlder
15}:
16
17buildPythonPackage rec {
18 pname = "w1thermsensor";
19 version = "2.3.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-n7wK4N1mzZtUxtYu17qyuI4UjJh/59UGD0dvkOgcInA=";
27 };
28
29 postPatch = ''
30 sed -i 's/3\.5\.\*/3.5/' setup.py
31 '';
32
33 nativeBuildInputs = [
34 setuptools
35 ];
36
37 propagatedBuildInputs = [
38 click
39 ];
40
41 passthru.optional-dependencies = {
42 async = [
43 aiofiles
44 ];
45 };
46
47 # Don't try to load the kernel module in tests.
48 env.W1THERMSENSOR_NO_KERNEL_MODULE = 1;
49
50 nativeCheckInputs = [
51 pytest-mock
52 pytest-asyncio
53 pytestCheckHook
54 ] ++ lib.optionals (pythonOlder "3.11") [
55 tomli
56 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
57
58 pythonImportsCheck = [
59 "w1thermsensor"
60 ];
61
62 meta = with lib; {
63 description = "Python interface to 1-Wire temperature sensors";
64 longDescription = ''
65 A Python package and CLI tool to work with w1 temperature sensors like
66 DS1822, DS18S20 & DS18B20 on the Raspberry Pi, Beagle Bone and other
67 devices.
68 '';
69 homepage = "https://github.com/timofurrer/w1thermsensor";
70 changelog = "https://github.com/timofurrer/w1thermsensor/blob/v${version}/CHANGELOG.rst";
71 license = licenses.mit;
72 maintainers = with maintainers; [ quentin ];
73 platforms = platforms.all;
74 };
75}