package: add new python packages
cover package: add new python packages
Hello,
this small series aims to introduce two new python packages:
- python-flask-socketio: allows event-based bi-directional communication between Flask applications and server
- python-gevent: a coroutine-based network library, as a dependency of python-flask-socketio
python-flask-socketio needs at least one of those dependencies:
- eventlet
- gevent
- flask dev server
[0] mentions that eventlet is discouraged for new projects, and [1] states that Flask webserver should not be used for production, hence this series selects gevent as the default dependency for python-flask-socketio.
- The two packages have been generated with ./utils/scanpypi, and adjusted accordingly (license, and build/runtime dependencies).
- Both packages bring a minimal test ensuring at least that the corresponding import can be performed as well as basic instantation/manipulation
- Both packages have been tested locally with ./utils/test-pkg, and ./support/testing/run-tests (through ./utils/docker-run)
[0] https://eventlet.readthedocs.io/en/latest/
[1] https://flask-socketio.readthedocs.io/en/latest/intro.html#requirements
---
Alexis Lothoré (2):
package/python-gevent: new package
package/python-flask-socketio: new package
DEVELOPERS | 2 ++ package/Config.in | 2 ++ package/python-flask-socketio/Config.in | 14 ++++++++++++++ .../python-flask-socketio/python-flask-socketio.hash | 5 +++++ .../python-flask-socketio/python-flask-socketio.mk | 14 ++++++++++++++ package/python-gevent/Config.in | 19 +++++++++++++++++++ package/python-gevent/python-gevent.hash | 5 +++++ package/python-gevent/python-gevent.mk | 16 ++++++++++++++++ .../tests/package/sample_python_flask_socketio.py | 5 +++++ support/testing/tests/package/sample_python_gevent.py | 7 +++++++ .../tests/package/test_python_flask_socketio.py | 12 ++++++++++++ support/testing/tests/package/test_python_gevent.py | 12 ++++++++++++ 12 files changed, 113 insertions(+)
---
base-commit: 94a817a58909e1cfe0c1f63b63754079f1866523
change-id: 20250804-python-packages-5e4a98a47c1d
Best regards,
Signature · 6 lines
Alexis Lothoré <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 package/python-gevent: new package
Bring python-gevent module as a standalone package.
Set GEVENTSETUP_EMBED=0 to prevent python-gevent from using its embedded libuv, libev and c-ares and rather use those packaged with buildroot.
--- DEVELOPERS | 1 + package/Config.in | 1 + package/python-gevent/Config.in | 19 +++++++++++++++++++ package/python-gevent/python-gevent.hash | 5 +++++ package/python-gevent/python-gevent.mk | 16 ++++++++++++++++ support/testing/tests/package/sample_python_gevent.py | 7 +++++++ support/testing/tests/package/test_python_gevent.py | 12 ++++++++++++ 7 files changed, 61 insertions(+)
DEVELOPERS +1 -0
@@ -155,6 +155,7 @@ N: Alexey Lukyanchuk <[email protected]> F: package/zabbix/ N: Alexis Lothoré <[email protected]> +F: package/python-gevent F: package/python-scp N: Alistair Francis <[email protected]>
package/Config.in +1 -0
@@ -1127,6 +1127,7 @@ menu "External python modules" source "package/python-fonttools/Config.in" source "package/python-frozenlist/Config.in" source "package/python-future/Config.in" + source "package/python-gevent/Config.in" source "package/python-git/Config.in" source "package/python-gitdb2/Config.in" source "package/python-gnupg/Config.in"
package/python-gevent/Config.in new file +19 -0
@@ -0,0 +1,19 @@ +config BR2_PACKAGE_PYTHON_GEVENT + bool "python-gevent" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # C++20 + select BR2_PACKAGE_C_ARES # runtime + select BR2_PACKAGE_LIBEV # runtime + select BR2_PACKAGE_LIBUV # runtime + select BR2_PACKAGE_HOST_PYTHON_CYTHON # build time + select BR2_PACKAGE_HOST_PYTHON_GREENLET # build time + select BR2_PACKAGE_HOST_PYTHON_CFFI # build time + select BR2_PACKAGE_PYTHON_GREENLET # runtime + select BR2_PACKAGE_PYTHON_ZOPEEVENT # runtime + select BR2_PACKAGE_PYTHON_ZOPE_INTERFACE # runtime + help + Coroutine-based network library. + + http://www.gevent.org/ + +comment "python-gevent needs a toolchain w/ C++, gcc >= 8" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
package/python-gevent/python-gevent.hash new file +5 -0
@@ -0,0 +1,5 @@ +# md5, sha256 from https://pypi.org/pypi/gevent/json +md5 a415693013e79df4c88a9e5fc90254bc gevent-25.9.1.tar.gz +sha256 adf9cd552de44a4e6754c51ff2e78d9193b7fa6eab123db9578a210e657235dd gevent-25.9.1.tar.gz +# Locally computed sha256 checksums +sha256 4d46bc11d19e3853d54325973b8e2c53090f5638a7bf27fa1f5f1232c78901f7 LICENSE
package/python-gevent/python-gevent.mk new file +16 -0
@@ -0,0 +1,16 @@ +################################################################################ +# +# python-gevent +# +################################################################################ + +PYTHON_GEVENT_VERSION = 25.9.1 +PYTHON_GEVENT_SOURCE = gevent-$(PYTHON_GEVENT_VERSION).tar.gz +PYTHON_GEVENT_SITE = https://files.pythonhosted.org/packages/9e/48/b3ef2673ffb940f980966694e40d6d32560f3ffa284ecaeb5ea3a90a6d3f +PYTHON_GEVENT_SETUP_TYPE = setuptools +PYTHON_GEVENT_DEPENDENCIES = libev libuv host-python-greenlet host-python-cffi host-python-cython +PYTHON_GEVENT_LICENSE = MIT +PYTHON_GEVENT_LICENSE_FILES = LICENSE +PYTHON_GEVENT_ENV = GEVENTSETUP_EMBED=0 + +$(eval $(python-package))
support/testing/tests/package/sample_python_gevent.py new file +7 -0
@@ -0,0 +1,7 @@ +# Example taken from the official documentation +import gevent +from gevent import socket + +urls = ['www.google.com', 'www.example.com', 'www.python.org'] +jobs = [gevent.spawn(socket.gethostbyname, url) for url in urls] +_ = gevent.joinall(jobs, timeout=2)
support/testing/tests/package/test_python_gevent.py new file +12 -0
@@ -0,0 +1,12 @@ +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonGevent(TestPythonPackageBase): + __test__ = True + config = TestPythonPackageBase.config + \ + """ + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_GEVENT=y + """ + sample_scripts = ["tests/package/sample_python_gevent.py"] + timeout = 30
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/python-flask-socketio: new package
In reply to Alexis Lothoré via buildroot--- DEVELOPERS | 1 + package/Config.in | 1 + package/python-flask-socketio/Config.in | 14 ++++++++++++++ package/python-flask-socketio/python-flask-socketio.hash | 5 +++++ package/python-flask-socketio/python-flask-socketio.mk | 14 ++++++++++++++ .../testing/tests/package/sample_python_flask_socketio.py | 5 +++++ .../testing/tests/package/test_python_flask_socketio.py | 12 ++++++++++++ 7 files changed, 52 insertions(+)
DEVELOPERS +1 -0
@@ -155,6 +155,7 @@ N: Alexey Lukyanchuk <[email protected]> F: package/zabbix/ N: Alexis Lothoré <[email protected]> +F: package/python-flask-socketio F: package/python-gevent F: package/python-scp
package/Config.in +1 -0
@@ -1120,6 +1120,7 @@ menu "External python modules" source "package/python-flask-login/Config.in" source "package/python-flask-restx/Config.in" source "package/python-flask-smorest/Config.in" + source "package/python-flask-socketio/Config.in" source "package/python-flask-sqlalchemy/Config.in" source "package/python-flask-wtf/Config.in" source "package/python-flatbuffers/Config.in"
package/python-flask-socketio/Config.in new file +14 -0
@@ -0,0 +1,14 @@ +config BR2_PACKAGE_PYTHON_FLASK_SOCKETIO + bool "python-flask-socketio" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # C++20 + select BR2_PACKAGE_PYTHON_FLASK # runtime + select BR2_PACKAGE_PYTHON_GEVENT # runtime + select BR2_PACKAGE_PYTHON_SOCKETIO # runtime + select BR2_PACKAGE_PYTHON3_SSL # runtime + help + Socket.IO integration for Flask applications. + + https://github.com/miguelgrinberg/flask-socketio + +comment "python-flask-socketio needs a toolchain w/ C++, gcc >= 8" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
package/python-flask-socketio/python-flask-socketio.hash new file +5 -0
@@ -0,0 +1,5 @@ +# md5, sha256 from https://pypi.org/pypi/flask-socketio/json +md5 50872c7e1d558fcbe60a942c5519703d flask_socketio-5.6.0.tar.gz +sha256 42a7bc552013633875ad320e39462323b4f7334594f1658d72b6ffed99940d4c flask_socketio-5.6.0.tar.gz +# Locally computed sha256 checksums +sha256 68d0966e480a8d2fd3d5c26d002c996ef08cdfa2b15a77d0d0b593b9abee60a4 LICENSE
package/python-flask-socketio/python-flask-socketio.mk new file +14 -0
@@ -0,0 +1,14 @@ +################################################################################ +# +# python-flask-socketio +# +################################################################################ + +PYTHON_FLASK_SOCKETIO_VERSION = 5.6.0 +PYTHON_FLASK_SOCKETIO_SOURCE = flask_socketio-$(PYTHON_FLASK_SOCKETIO_VERSION).tar.gz +PYTHON_FLASK_SOCKETIO_SITE = https://files.pythonhosted.org/packages/53/28/deac60f5c6faf9c3e0aed07aa3a92b0741c6709841aa3eba12417bbc8303 +PYTHON_FLASK_SOCKETIO_SETUP_TYPE = setuptools +PYTHON_FLASK_SOCKETIO_LICENSE = MIT +PYTHON_FLASK_SOCKETIO_LICENSE_FILES = LICENSE + +$(eval $(python-package))
support/testing/tests/package/sample_python_flask_socketio.py new file +5 -0
@@ -0,0 +1,5 @@ +from flask import Flask +from flask_socketio import SocketIO + +app = Flask('test') +socketio = SocketIO(app)
support/testing/tests/package/test_python_flask_socketio.py new file +12 -0
@@ -0,0 +1,12 @@ +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonFlaskSocketIO(TestPythonPackageBase): + __test__ = True + config = TestPythonPackageBase.config + \ + """ + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_FLASK_SOCKETIO=y + """ + sample_scripts = ["tests/package/sample_python_flask_socketio.py"] + timeout = 30
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot