python-schema: bump to 0.7.8
authorAlexandru Ardelean <redacted>
Sat, 28 Mar 2026 19:07:38 +0000 (19:07 +0000)
committerAlexandru Ardelean <redacted>
Wed, 1 Apr 2026 07:29:21 +0000 (10:29 +0300)
Changes since 0.7.5:
- Fix handling of Optional keys with default values
- Improve error messages for nested schema failures
- Various bug fixes and compatibility improvements

Also add test.sh to verify version and data validation API.

Link: https://github.com/keleshev/schema/blob/master/CHANGELOG.rst
Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python-schema/Makefile
lang/python/python-schema/test.sh [new file with mode: 0755]

index 537a32fbc132ace03620213dc23c6f10dd99f39b..3e9ad398d2df30417f289c887071153f704e34f0 100644 (file)
@@ -5,12 +5,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=python-schema
-PKG_VERSION:=0.7.5
+PKG_VERSION:=0.7.8
 PKG_RELEASE:=1
 PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com> 
 
 PYPI_NAME:=schema
-PKG_HASH:=f06717112c61895cabc4707752b88716e8420a8819d71404501e114f91043197
+PKG_HASH:=e86cc08edd6fe6e2522648f4e47e3a31920a76e82cce8937535422e310862ab5
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE-MIT
diff --git a/lang/python/python-schema/test.sh b/lang/python/python-schema/test.sh
new file mode 100755 (executable)
index 0000000..28db068
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+[ "$1" = "python3-schema" ] || exit 0
+
+python3 - << EOF
+import sys
+import schema as sc
+
+if sc.__version__ != "$2":
+    print("Wrong version: " + sc.__version__)
+    sys.exit(1)
+
+from schema import Schema, SchemaError, Optional, And, Or
+
+# Basic type validation
+s = Schema(int)
+assert s.validate(42) == 42
+try:
+    s.validate("not an int")
+    sys.exit(1)
+except SchemaError:
+    pass
+
+# Dict schema
+s = Schema({"name": str, "age": And(int, lambda n: n > 0)})
+data = s.validate({"name": "Alice", "age": 30})
+assert data["name"] == "Alice"
+assert data["age"] == 30
+
+# Optional key
+s = Schema({"key": str, Optional("opt"): int})
+assert s.validate({"key": "val"}) == {"key": "val"}
+
+# Or
+s = Schema(Or(int, str))
+assert s.validate(1) == 1
+assert s.validate("x") == "x"
+
+sys.exit(0)
+EOF
git clone https://git.99rst.org/PROJECT