1{
2 lib,
3 buildPythonPackage,
4 click,
5 fetchFromGitHub,
6 justbackoff,
7 pyserial-asyncio,
8 pythonOlder,
9 pytest-asyncio,
10 pytestCheckHook,
11 setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "nessclient";
16 version = "1.1.2";
17 pyproject = true;
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "nickw444";
23 repo = "nessclient";
24 tag = version;
25 hash = "sha256-STDEIY7D02MlH+R6uLAKl6ghSQjhG1OEQWj71DrZP30=";
26 };
27
28 postPatch = ''
29 substituteInPlace setup.py \
30 --replace-fail "version = '0.0.0-dev'" "version = '${version}'"
31 '';
32
33 build-system = [ setuptools ];
34
35 dependencies = [
36 justbackoff
37 pyserial-asyncio
38 ];
39
40 optional-dependencies = {
41 cli = [ click ];
42 };
43
44 nativeCheckInputs = [
45 pytest-asyncio
46 pytestCheckHook
47 ];
48
49 pythonImportsCheck = [ "nessclient" ];
50
51 meta = with lib; {
52 description = "Python implementation/abstraction of the Ness D8x/D16x Serial Interface ASCII protocol";
53 homepage = "https://github.com/nickw444/nessclient";
54 changelog = "https://github.com/nickw444/nessclient/releases/tag/${version}";
55 license = licenses.mit;
56 maintainers = with maintainers; [ fab ];
57 mainProgram = "ness-cli";
58 };
59}