python3Packages.openplantbook-sdk: init at 0.6.1

This commit is contained in:
Sandro Jäckel
2026-03-17 20:15:05 +01:00
parent c26f7ab077
commit 4e1046f154
3 changed files with 93 additions and 0 deletions
@@ -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;
};
}
@@ -0,0 +1,32 @@
commit b5c20736ca6270b6ac20ee24e4788cfc656815cb
Author: Sandro Jäckel <sandro.jaeckel@gmail.com>
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
+2
View File
@@ -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 { };