From: Alexandru Ardelean Date: Thu, 9 Apr 2026 05:35:37 +0000 (+0300) Subject: python-outcome: update to 1.3.0 X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=1158559cef450b8f8491393345659b735c83b5a6;p=openwrt-packages.git python-outcome: update to 1.3.0 Update package to 1.3.0. Changes since 1.2.0: 1.3.0: - Added full type hints; Value and Outcome are now generic classes - Added Maybe type alias as a union of Value[T] and Error - Added typed __all__ exports and marked __version__ as a public constant - Functions that do not return are now captured as Error - Added pyright --verifytypes to CI; strict mypy mode enabled Signed-off-by: Alexandru Ardelean --- diff --git a/lang/python/python-outcome/Makefile b/lang/python/python-outcome/Makefile index d377acd17..d49685669 100644 --- a/lang/python/python-outcome/Makefile +++ b/lang/python/python-outcome/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=python-outcome -PKG_VERSION:=1.2.0 -PKG_RELEASE:=2 +PKG_VERSION:=1.3.0 +PKG_RELEASE:=1 PYPI_NAME:=outcome -PKG_HASH:=6f82bd3de45da303cf1f771ecafa1633750a358436a8bb60e06a1ceb745d2672 +PKG_HASH:=588ef4dc10b64e8df160d8d1310c44e1927129a66d6d2ef86845cef512c5f24c PKG_LICENSE:=Apache-2.0 MIT PKG_LICENSE_FILES:=LICENSE.APACHE2 LICENSE.MIT diff --git a/lang/python/python-outcome/test.sh b/lang/python/python-outcome/test.sh new file mode 100755 index 000000000..5f983ecbe --- /dev/null +++ b/lang/python/python-outcome/test.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +[ "$1" = python3-outcome ] || exit 0 + +python3 - << 'EOF' +from outcome import Value, Error, capture, acapture + +# Value outcome +v = Value(42) +assert v.value == 42 +assert v.unwrap() == 42 + +# Error outcome +e = Error(ValueError("oops")) +assert isinstance(e.error, ValueError) +try: + e.unwrap() + assert False, "Should have raised" +except ValueError as exc: + assert str(exc) == "oops" + +# capture() +result = capture(lambda: 1 + 1) +assert isinstance(result, Value) +assert result.value == 2 + +result2 = capture(lambda: 1 / 0) +assert isinstance(result2, Error) +assert isinstance(result2.error, ZeroDivisionError) + +# acapture is present and callable (async test omitted: python3-asyncio not a dependency) +assert callable(acapture) +EOF