diff --git a/pkgs/development/python-modules/async-modbus/default.nix b/pkgs/development/python-modules/async-modbus/default.nix new file mode 100644 index 000000000000..84423c6afbbc --- /dev/null +++ b/pkgs/development/python-modules/async-modbus/default.nix @@ -0,0 +1,57 @@ +{ lib +, buildPythonPackage +, connio +, fetchFromGitHub +, pytest-asyncio +, pytestCheckHook +, pythonOlder +, setuptools +, umodbus +}: + +buildPythonPackage rec { + pname = "async-modbus"; + version = "0.2.0"; + format = "pyproject"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "tiagocoutinho"; + repo = "async_modbus"; + rev = "refs/tags/v${version}"; + hash = "sha256-TB+ndUvLZ9G3XXEBpLb4ULHlYZC2CoqGnL2BjMQrhRg="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace '"--cov=async_modbus",' "" \ + --replace '"--cov-report=html", "--cov-report=term",' "" \ + --replace '"--durations=2", "--verbose"' "" + ''; + + nativeBuildInputs = [ + setuptools + ]; + + propagatedBuildInputs = [ + connio + umodbus + ]; + + checkInputs = [ + pytest-asyncio + pytestCheckHook + ]; + + pythonImportsCheck = [ + "async_modbus" + ]; + + meta = with lib; { + description = "Library for Modbus communication"; + homepage = "https://github.com/tiagocoutinho/async_modbus"; + license = with licenses; [ gpl3Plus ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/connio/default.nix b/pkgs/development/python-modules/connio/default.nix new file mode 100644 index 000000000000..14574ab9da33 --- /dev/null +++ b/pkgs/development/python-modules/connio/default.nix @@ -0,0 +1,42 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +, pythonOlder +, serialio +, sockio +}: + +buildPythonPackage rec { + pname = "connio"; + version = "0.2.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "tiagocoutinho"; + repo = pname; + rev = "refs/tags/v${version}"; + hash = "sha256-fPM7Ya69t0jpZhKM2MTk6BwjvoW3a8SV3k000LB9Ypo="; + }; + + propagatedBuildInputs = [ + serialio + sockio + ]; + + # Module has no tests + doCheck = false; + + pythonImportsCheck = [ + "connio" + ]; + + meta = with lib; { + description = "Library for concurrency agnostic communication"; + homepage = "https://github.com/tiagocoutinho/connio"; + license = with licenses; [ gpl3Plus ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/nibe/default.nix b/pkgs/development/python-modules/nibe/default.nix new file mode 100644 index 000000000000..4a3ce21b82a7 --- /dev/null +++ b/pkgs/development/python-modules/nibe/default.nix @@ -0,0 +1,57 @@ +{ lib +, aiohttp +, aresponses +, async-modbus +, async-timeout +, buildPythonPackage +, construct +, fetchFromGitHub +, pytest-asyncio +, pytestCheckHook +, pythonOlder +, setuptools +, tenacity +}: + +buildPythonPackage rec { + pname = "nibe"; + version = "1.2.1"; + format = "pyproject"; + + disabled = pythonOlder "3.9"; + + src = fetchFromGitHub { + owner = "yozik04"; + repo = pname; + rev = "refs/tags/${version}"; + hash = "sha256-y1/yZE5Gfj2XPscZ27TNXOM/VGy/iIFkvg2TCNsh4tI="; + }; + + nativeBuildInputs = [ + setuptools + ]; + + propagatedBuildInputs = [ + async-modbus + async-timeout + construct + tenacity + ]; + + checkInputs = [ + aresponses + pytest-asyncio + pytestCheckHook + ]; + + pythonImportsCheck = [ + "nibe" + ]; + + meta = with lib; { + description = "Library for the communication with Nibe heatpumps"; + homepage = "https://github.com/yozik04/nibe"; + license = with licenses; [ gpl3Plus ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/serialio/default.nix b/pkgs/development/python-modules/serialio/default.nix new file mode 100644 index 000000000000..56f82e449a70 --- /dev/null +++ b/pkgs/development/python-modules/serialio/default.nix @@ -0,0 +1,43 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytest-asyncio +, pytestCheckHook +, pythonOlder +, pyserial +, sockio +}: + +buildPythonPackage rec { + pname = "serialio"; + version = "2.4.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "tiagocoutinho"; + repo = pname; + rev = "refs/tags/v${version}"; + hash = "sha256-9TRGT0wpoRRcHqnH1XzlMBh0IcVzdEcOzN7hkeYnoW4="; + }; + + propagatedBuildInputs = [ + pyserial + sockio + ]; + + # Module has no tests + doCheck = false; + + pythonImportsCheck = [ + "serialio" + ]; + + meta = with lib; { + description = "Library for concurrency agnostic serial connunication"; + homepage = "https://github.com/tiagocoutinho/serialio"; + license = with licenses; [ gpl3Plus ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/sockio/default.nix b/pkgs/development/python-modules/sockio/default.nix new file mode 100644 index 000000000000..6476c88c31a6 --- /dev/null +++ b/pkgs/development/python-modules/sockio/default.nix @@ -0,0 +1,80 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytest-asyncio +, pytestCheckHook +, pythonOlder +}: + +buildPythonPackage rec { + pname = "sockio"; + version = "0.15.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "tiagocoutinho"; + repo = pname; + rev = "refs/tags/v${version}"; + hash = "sha256-NSGd7/k1Yr408dipMNBSPRSwQ+wId7VLxgqMM/UmN/Q="; + }; + + postPatch = '' + substituteInPlace setup.cfg \ + --replace "--cov-config=.coveragerc --cov sockio" "" \ + --replace "--cov-report html --cov-report term" "" \ + --replace "--durations=2 --verbose" "" + ''; + + checkInputs = [ + pytest-asyncio + pytestCheckHook + ]; + + pythonImportsCheck = [ + "sockio" + ]; + + disabledTests = [ + # Tests require network access + "test_open_timeout" + "test_write_readline_error" + "test_open_close" + "test_callbacks" + "test_coroutine_callbacks" + "test_error_callback" + "test_eof_callback" + "test_write_read" + "test_write_readline" + "test_write_readlines" + "test_writelines_readlines" + "test_writelines" + "test_readline" + "test_readuntil" + "test_readexactly" + "test_readlines" + "test_read" + "test_readbuffer" + "test_parallel_rw" + "test_parallel" + "test_stream" + "test_timeout" + "test_line_stream" + "test_block_stream" + "test_socket_for_url" + "test_root_socket_for_url" + ]; + + disabledTestPaths = [ + # We don't care about Python 2.x + "tests/test_py2.py" + ]; + + meta = with lib; { + description = "Implementation of the Modbus protocol"; + homepage = "https://tiagocoutinho.github.io/sockio/"; + license = with licenses; [ gpl3Plus ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/umodbus/default.nix b/pkgs/development/python-modules/umodbus/default.nix new file mode 100644 index 000000000000..845548dcb790 --- /dev/null +++ b/pkgs/development/python-modules/umodbus/default.nix @@ -0,0 +1,42 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pyserial +, pytestCheckHook +, pythonOlder +, setuptools +}: + +buildPythonPackage rec { + pname = "umodbus"; + version = "1.0.4"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "AdvancedClimateSystems"; + repo = "uModbus"; + rev = "refs/tags/${version}"; + hash = "sha256-5IXadb5mjrMwr+L9S1iMN5kba5VGrzYt1p8nBvvLCh4="; + }; + + propagatedBuildInputs = [ + pyserial + ]; + + checkInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "umodbus" + ]; + + meta = with lib; { + description = "Implementation of the Modbus protocol"; + homepage = "https://github.com/AdvancedClimateSystems/uModbus/"; + license = with licenses; [ mpl20 ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 4ba82df927e0..c2974f0f4e0d 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -2128,8 +2128,9 @@ "nfandroidtv" = ps: with ps; [ ]; # missing inputs: notifications-android-tv "nibe_heatpump" = ps: with ps; [ + nibe tenacity - ]; # missing inputs: nibe + ]; "nightscout" = ps: with ps; [ py-nightscout ]; @@ -4144,6 +4145,7 @@ "nexia" "nextbus" "nextdns" + "nibe_heatpump" "nightscout" "nina" "nmap_tracker" diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 6eca3b16bdf6..270e5269306b 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -62,6 +62,16 @@ let }; }); + nibe = super.nibe.overridePythonAttrs (oldAttrs: rec { + version = "0.5.0"; + src = fetchFromGitHub { + owner = "yozik04"; + repo = "nibe"; + rev = "refs/tags/${version}"; + hash = "sha256-DguGWNJfc5DfbcKMX2eMM2U1WyVPcdtv2BmpVloOFSU="; + }; + }); + # pytest-aiohttp>0.3.0 breaks home-assistant tests pytest-aiohttp = super.pytest-aiohttp.overridePythonAttrs (oldAttrs: rec { version = "0.3.0"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index af0c07084a9f..6b1c53d1e4be 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -666,6 +666,8 @@ self: super: with self; { async-lru = callPackage ../development/python-modules/async-lru { }; + async-modbus = callPackage ../development/python-modules/async-modbus { }; + asyncclick = callPackage ../development/python-modules/asyncclick { }; asynccmd = callPackage ../development/python-modules/asynccmd { }; @@ -1564,6 +1566,8 @@ self: super: with self; { connection-pool = callPackage ../development/python-modules/connection-pool { }; + connio = callPackage ../development/python-modules/connio { }; + coqpit = callPackage ../development/python-modules/coqpit { }; coqui-trainer = callPackage ../development/python-modules/coqui-trainer {}; @@ -6133,6 +6137,8 @@ self: super: with self; { nibabel = callPackage ../development/python-modules/nibabel { }; + nibe = callPackage ../development/python-modules/nibe { }; + nidaqmx = callPackage ../development/python-modules/nidaqmx { }; Nikola = callPackage ../development/python-modules/Nikola { }; @@ -10098,6 +10104,8 @@ self: super: with self; { pythonSupport = true; })); + serialio = callPackage ../development/python-modules/serialio { }; + serpent = callPackage ../development/python-modules/serpent { }; serpy = callPackage ../development/python-modules/serpy { }; @@ -10362,6 +10370,8 @@ self: super: with self; { socid-extractor = callPackage ../development/python-modules/socid-extractor { }; + sockio = callPackage ../development/python-modules/sockio { }; + sockjs = callPackage ../development/python-modules/sockjs { }; sockjs-tornado = callPackage ../development/python-modules/sockjs-tornado { }; @@ -11470,6 +11480,8 @@ self: super: with self; { umap-learn = callPackage ../development/python-modules/umap-learn { }; + umodbus = callPackage ../development/python-modules/umodbus { }; + u-msgpack-python = callPackage ../development/python-modules/u-msgpack-python { }; unasync = callPackage ../development/python-modules/unasync { };