From 4e1046f1549f3d6007400c26c2dc7c021e256c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 10 Mar 2026 02:44:02 +0100 Subject: [PATCH] python3Packages.openplantbook-sdk: init at 0.6.1 --- .../openplantbook-sdk/default.nix | 59 +++++++++++++++++++ .../openplantbook-sdk/update-test.patch | 32 ++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 93 insertions(+) create mode 100644 pkgs/development/python-modules/openplantbook-sdk/default.nix create mode 100644 pkgs/development/python-modules/openplantbook-sdk/update-test.patch diff --git a/pkgs/development/python-modules/openplantbook-sdk/default.nix b/pkgs/development/python-modules/openplantbook-sdk/default.nix new file mode 100644 index 000000000000..b4c6ae569bd5 --- /dev/null +++ b/pkgs/development/python-modules/openplantbook-sdk/default.nix @@ -0,0 +1,59 @@ +{ + lib, + aiohttp, + buildPythonPackage, + fetchFromGitHub, + json-timeseries, + numpy, + pandas, + pytestCheckHook, + pyyaml, + setuptools, + setuptools-scm, +}: + +buildPythonPackage { + pname = "openplantbook-sdk"; + version = "0.6.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "slaxor505"; + repo = "openplantbook-sdk-py"; + rev = "097ccfbd5cee6a271c79c923f1761249eca4bda1"; + hash = "sha256-udzm8Efl3QX2jrvfzA/oCvk2kjQEFFOZCOFqKNzUUu8="; + }; + + patches = [ + # https://github.com/slaxor505/openplantbook-sdk-py/pull/2 + ./update-test.patch + ]; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + aiohttp + json-timeseries + ]; + + nativeBuildInputs = [ + numpy + pandas + pyyaml + pytestCheckHook + ]; + + enabledTestPaths = [ + "tests/offline" + ]; + + meta = { + description = "SDK to integrate with Open Plantbook API"; + homepage = "https://github.com/slaxor505/openplantbook-sdk-py"; + maintainers = with lib.maintainers; [ SuperSandro2000 ]; + license = lib.licenses.mit; + }; +} diff --git a/pkgs/development/python-modules/openplantbook-sdk/update-test.patch b/pkgs/development/python-modules/openplantbook-sdk/update-test.patch new file mode 100644 index 000000000000..0ad2dff91a1c --- /dev/null +++ b/pkgs/development/python-modules/openplantbook-sdk/update-test.patch @@ -0,0 +1,32 @@ +commit b5c20736ca6270b6ac20ee24e4788cfc656815cb +Author: Sandro Jäckel +Date: Tue, 10 Mar 2026 02:42:27 +0100 + + Update tests + +diff --git a/tests/offline/test_async_plant_detail_lang.py b/tests/offline/test_async_plant_detail_lang.py +index 3d460fb..75e4018 100644 +--- a/tests/offline/test_async_plant_detail_lang.py ++++ b/tests/offline/test_async_plant_detail_lang.py +@@ -75,7 +75,7 @@ def test_forwards_lang_param_when_provided(self): + self.assertIn("Authorization", sess.headers) + self.assertTrue(sess.headers["Authorization"].startswith("Bearer ")) + # Assert that the request URL targets the expected endpoint +- self.assertTrue(sess.last_get_url.endswith("/plant/detail/abelia chinensis")) ++ self.assertTrue(sess.last_get_url.endswith("/plant/detail/abelia chinensis/")) + # Critical assertion: 'lang' param is forwarded + self.assertEqual(sess.last_get_params, {"lang": "de"}) + +diff --git a/tests/offline/test_pass_through_params.py b/tests/offline/test_pass_through_params.py +index 62c2443..0ea36a9 100644 +--- a/tests/offline/test_pass_through_params.py ++++ b/tests/offline/test_pass_through_params.py +@@ -118,7 +118,7 @@ def test_detail_merges_and_overrides_lang_and_kwargs(self): + self.assertIn("Authorization", sess.headers) + self.assertTrue(sess.headers["Authorization"].startswith("Bearer ")) + # Request URL targets the expected endpoint +- self.assertTrue(sess.last_get_url.endswith("/plant/detail/abelia chinensis")) ++ self.assertTrue(sess.last_get_url.endswith("/plant/detail/abelia chinensis/")) + # 'lang' from explicit arg overrides value in params; other params are preserved + self.assertEqual(sess.last_get_params, {"lang": "de", "page": "2"}) + # request_kwargs forwarded to session.get diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3799af6a409b..d14cca86242b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11574,6 +11574,8 @@ self: super: with self; { openpaperwork-gtk = callPackage ../applications/office/paperwork/openpaperwork-gtk.nix { }; + openplantbook-sdk = callPackage ../development/python-modules/openplantbook-sdk { }; + openpyxl = callPackage ../development/python-modules/openpyxl { }; openrazer = callPackage ../development/python-modules/openrazer/pylib.nix { };