diff mbox series

[v3] package/python-questionary: new package

Message ID 20260828090757.1862504-1-manuel.diener@oss.othermo.de
State New
Headers show
Series [v3] package/python-questionary: new package | expand

Commit Message

Manuel Diener Aug. 28, 2026, 9:07 a.m. UTC
Signed-off-by: Manuel Diener <manuel.diener@oss.othermo.de>
---
 DEVELOPERS                                    |  2 ++
 package/Config.in                             |  1 +
 package/python-questionary/Config.in          |  8 ++++++++
 .../python-questionary.hash                   |  5 +++++
 .../python-questionary/python-questionary.mk  | 14 +++++++++++++
 .../package/sample_python_questionary.py      | 16 +++++++++++++++
 .../tests/package/test_python_questionary.py  | 20 +++++++++++++++++++
 7 files changed, 66 insertions(+)
 create mode 100644 package/python-questionary/Config.in
 create mode 100644 package/python-questionary/python-questionary.hash
 create mode 100644 package/python-questionary/python-questionary.mk
 create mode 100644 support/testing/tests/package/sample_python_questionary.py
 create mode 100644 support/testing/tests/package/test_python_questionary.py
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 49a72bb69a..edd2e46117 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2252,6 +2252,7 @@  F:	package/python-log-rate-limit/
 F:	package/python-pydantic/
 F:	package/python-pydantic-core/
 F:	package/python-pydantic-settings/
+F:	package/python-questionary/
 F:	package/python-typing-inspection/
 F:	package/python-tzlocal/
 F:	package/python-sdbus-modemmanager/
@@ -2259,6 +2260,7 @@  F:	package/python-sdbus-systemd/
 F:	package/python-varlink/
 F:	package/python-waitress/
 F:	package/python-whitenoise/
+F:	support/testing/tests/package/test_python_questionary.py
 
 N:	Marcin Bis <marcin@bis.org.pl>
 F:	package/bluez5_utils/
diff --git a/package/Config.in b/package/Config.in
index 6058800682..f363e16069 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1377,6 +1377,7 @@  menu "External python modules"
 	source "package/python-pyyaml/Config.in"
 	source "package/python-pyzmq/Config.in"
 	source "package/python-qrcode/Config.in"
+	source "package/python-questionary/Config.in"
 	source "package/python-raven/Config.in"
 	source "package/python-redis/Config.in"
 	source "package/python-reedsolo/Config.in"
diff --git a/package/python-questionary/Config.in b/package/python-questionary/Config.in
new file mode 100644
index 0000000000..06bc269b4a
--- /dev/null
+++ b/package/python-questionary/Config.in
@@ -0,0 +1,8 @@ 
+config BR2_PACKAGE_PYTHON_QUESTIONARY
+	bool "python-questionary"
+	select BR2_PACKAGE_PYTHON_PROMPT_TOOLKIT
+	help
+	  Python library for effortlessly building pretty
+	  command line interfaces.
+
+	  https://github.com/tmbo/questionary
diff --git a/package/python-questionary/python-questionary.hash b/package/python-questionary/python-questionary.hash
new file mode 100644
index 0000000000..c350e024ff
--- /dev/null
+++ b/package/python-questionary/python-questionary.hash
@@ -0,0 +1,5 @@ 
+# md5, sha256 from https://pypi.org/pypi/questionary/json
+md5  0c7b9d9ba6c6b4ba94f5e705850cd0c3  questionary-2.1.1.tar.gz
+sha256  3d7e980292bb0107abaa79c68dd3eee3c561b83a0f89ae482860b181c8bd412d  questionary-2.1.1.tar.gz
+# Locally computed sha256 checksums
+sha256  3a492ab6d436c5e75f54a9a556de91c4322c8ad408fe849c7da1f7352721c63a  LICENSE
diff --git a/package/python-questionary/python-questionary.mk b/package/python-questionary/python-questionary.mk
new file mode 100644
index 0000000000..803735d5e5
--- /dev/null
+++ b/package/python-questionary/python-questionary.mk
@@ -0,0 +1,14 @@ 
+################################################################################
+#
+# python-questionary
+#
+################################################################################
+
+PYTHON_QUESTIONARY_VERSION = 2.1.1
+PYTHON_QUESTIONARY_SOURCE = questionary-$(PYTHON_QUESTIONARY_VERSION).tar.gz
+PYTHON_QUESTIONARY_SITE = https://files.pythonhosted.org/packages/f6/45/eafb0bba0f9988f6a2520f9ca2df2c82ddfa8d67c95d6625452e97b204a5
+PYTHON_QUESTIONARY_SETUP_TYPE = poetry
+PYTHON_QUESTIONARY_LICENSE = MIT
+PYTHON_QUESTIONARY_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_questionary.py b/support/testing/tests/package/sample_python_questionary.py
new file mode 100644
index 0000000000..de707f1ec3
--- /dev/null
+++ b/support/testing/tests/package/sample_python_questionary.py
@@ -0,0 +1,16 @@ 
+# questionary is tricky to test as there seems to be no option to pass in stdin.
+# Therefore the ask is going to time out on purpose so the test can check if the ask
+# was successfully written to stdout.
+
+import questionary
+import asyncio
+
+async def main():
+    try:
+        async with asyncio.timeout(5):
+            await questionary.press_any_key_to_continue().ask_async()
+    except:
+        raise
+
+if __name__ == '__main__':
+    asyncio.run(main())
diff --git a/support/testing/tests/package/test_python_questionary.py b/support/testing/tests/package/test_python_questionary.py
new file mode 100644
index 0000000000..3050259296
--- /dev/null
+++ b/support/testing/tests/package/test_python_questionary.py
@@ -0,0 +1,20 @@ 
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonQuestionary(TestPythonPackageBase):
+    sample_scripts = ["tests/package/sample_python_questionary.py"]
+
+    def run_sample_scripts(self):
+        cmd = self.interpreter + " sample_python_questionary.py"
+        output, exit_code = self.emulator.run(cmd, timeout=10)
+        self.assertIn("Press any key to continue...", output[0])
+        self.assertEqual(exit_code, 1)
+
+
+class TestPythonPy3Questionary(TestPythonQuestionary):
+    __test__ = True
+    config = TestPythonQuestionary.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_QUESTIONARY=y
+        """