1{ lib
2, aiohttp
3, buildPythonPackage
4, click
5, fetchFromGitHub
6, mock
7, prompt-toolkit
8, pygments
9, pyserial
10, pytest-asyncio
11, pytest-xdist
12, pytestCheckHook
13, redis
14, sqlalchemy
15, twisted
16, typer
17}:
18
19buildPythonPackage rec {
20 pname = "pymodbus";
21 version = "3.5.2";
22 format = "setuptools";
23
24 src = fetchFromGitHub {
25 owner = "pymodbus-dev";
26 repo = pname;
27 rev = "refs/tags/v${version}";
28 hash = "sha256-FOmR9yqLagqcsAVxqHxziEcnZ5M9QpL2qIp8x2gS2PU=";
29 };
30
31 passthru.optional-dependencies = {
32 repl = [
33 aiohttp
34 typer
35 prompt-toolkit
36 pygments
37 click
38 ] ++ typer.optional-dependencies.all;
39 serial = [
40 pyserial
41 ];
42 };
43
44 nativeCheckInputs = [
45 mock
46 pytest-asyncio
47 pytest-xdist
48 pytestCheckHook
49 redis
50 sqlalchemy
51 twisted
52 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
53
54 preCheck = ''
55 pushd test
56 '';
57
58 postCheck = ''
59 popd
60 '';
61
62 pythonImportsCheck = [
63 "pymodbus"
64 ];
65
66 disabledTests = [
67 # Tests often hang
68 "test_connected"
69 ];
70
71 meta = with lib; {
72 description = "Python implementation of the Modbus protocol";
73 longDescription = ''
74 Pymodbus is a full Modbus protocol implementation using twisted,
75 torndo or asyncio for its asynchronous communications core. It can
76 also be used without any third party dependencies if a more
77 lightweight project is needed.
78 '';
79 homepage = "https://github.com/pymodbus-dev/pymodbus";
80 changelog = "https://github.com/pymodbus-dev/pymodbus/releases/tag/v${version}";
81 license = with licenses; [ bsd3 ];
82 maintainers = with maintainers; [ fab ];
83 };
84}