aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2025-04-09 13:53:00 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2025-04-09 13:53:00 +0000
commit832aa5703a6569b49d2137b1f65ab7d9684510b0 (patch)
treec15dd1ab06181e0517ab1e16f731c8efc94fe9f0
parent37a98fa262238be232cc4b3cfa6694250b219fc3 (diff)
devel/py-blockbuster: Add py-blockbuster 1.5.24
Blockbuster is a Python package designed to detect and prevent blocking calls within an asynchronous event loop. It is particularly useful when executing tests to ensure that your asynchronous code does not inadvertently call blocking operations, which can lead to performance bottlenecks and unpredictable behavior. In Python, the asynchronous event loop allows for concurrent execution of tasks without the need for multiple threads or processes. This is achieved by running tasks cooperatively, where tasks yield control back to the event loop when they are waiting for I/O operations or other long-running tasks to complete. However, blocking calls, such as file I/O operations or certain networking operations, can halt the entire event loop, preventing other tasks from running. This can lead to increased latency and reduced performance, defeating the purpose of using asynchronous programming. The difficulty with blocking calls is that they are not always obvious, especially when working with third-party libraries or legacy code. This is where Blockbuster comes in: it helps you identify and eliminate blocking calls in your codebase during testing, ensuring that your asynchronous code runs smoothly and efficiently. It does this by wrapping common blocking functions and raising an exception when they are called within an asynchronous context. Notes: - Blockbuster currently only detects asyncio event loops. - Blockbuster is tested only with CPython. It may work with other Python implementations if it's possible to monkey-patch the functions with setattr.
-rw-r--r--devel/Makefile1
-rw-r--r--devel/py-blockbuster/Makefile22
-rw-r--r--devel/py-blockbuster/distinfo3
-rw-r--r--devel/py-blockbuster/pkg-descr27
4 files changed, 53 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index 314b29b22fc7..e63f5d3d97d4 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -4580,6 +4580,7 @@
SUBDIR += py-blessed
SUBDIR += py-blessings
SUBDIR += py-blinker
+ SUBDIR += py-blockbuster
SUBDIR += py-bluelet
SUBDIR += py-boltons
SUBDIR += py-boolean.py
diff --git a/devel/py-blockbuster/Makefile b/devel/py-blockbuster/Makefile
new file mode 100644
index 000000000000..82f520d64782
--- /dev/null
+++ b/devel/py-blockbuster/Makefile
@@ -0,0 +1,22 @@
+PORTNAME= blockbuster
+PORTVERSION= 1.5.24
+CATEGORIES= devel python
+MASTER_SITES= PYPI
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER= sunpoet@FreeBSD.org
+COMMENT= Utility to detect blocking calls in the async event loop
+WWW= https://github.com/cbornet/blockbuster
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatchling>=0:devel/py-hatchling@${PY_FLAVOR}
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}forbiddenfruit>=0.1.4:devel/py-forbiddenfruit@${PY_FLAVOR}
+
+USES= python
+USE_PYTHON= autoplist concurrent pep517
+
+NO_ARCH= yes
+
+.include <bsd.port.mk>
diff --git a/devel/py-blockbuster/distinfo b/devel/py-blockbuster/distinfo
new file mode 100644
index 000000000000..97c4c8575bd1
--- /dev/null
+++ b/devel/py-blockbuster/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1742405432
+SHA256 (blockbuster-1.5.24.tar.gz) = 97645775761a5d425666ec0bc99629b65c7eccdc2f770d2439850682567af4ec
+SIZE (blockbuster-1.5.24.tar.gz) = 51245
diff --git a/devel/py-blockbuster/pkg-descr b/devel/py-blockbuster/pkg-descr
new file mode 100644
index 000000000000..e0565c78fbef
--- /dev/null
+++ b/devel/py-blockbuster/pkg-descr
@@ -0,0 +1,27 @@
+Blockbuster is a Python package designed to detect and prevent blocking calls
+within an asynchronous event loop. It is particularly useful when executing
+tests to ensure that your asynchronous code does not inadvertently call blocking
+operations, which can lead to performance bottlenecks and unpredictable
+behavior.
+
+In Python, the asynchronous event loop allows for concurrent execution of tasks
+without the need for multiple threads or processes. This is achieved by running
+tasks cooperatively, where tasks yield control back to the event loop when they
+are waiting for I/O operations or other long-running tasks to complete.
+
+However, blocking calls, such as file I/O operations or certain networking
+operations, can halt the entire event loop, preventing other tasks from running.
+This can lead to increased latency and reduced performance, defeating the
+purpose of using asynchronous programming.
+
+The difficulty with blocking calls is that they are not always obvious,
+especially when working with third-party libraries or legacy code. This is where
+Blockbuster comes in: it helps you identify and eliminate blocking calls in your
+codebase during testing, ensuring that your asynchronous code runs smoothly and
+efficiently. It does this by wrapping common blocking functions and raising an
+exception when they are called within an asynchronous context.
+
+Notes:
+- Blockbuster currently only detects asyncio event loops.
+- Blockbuster is tested only with CPython. It may work with other Python
+ implementations if it's possible to monkey-patch the functions with setattr.