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