git: 383c0f67ccfe - main - net/py-duet: New port: Simple future-based async library for python

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 15 Nov 2021 00:27:28 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=383c0f67ccfe5ec71f127cec7b3ce7be8bc530b8

commit 383c0f67ccfe5ec71f127cec7b3ce7be8bc530b8
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2021-11-14 23:32:03 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2021-11-15 00:27:21 +0000

    net/py-duet: New port: Simple future-based async library for python
---
 net/Makefile          |  1 +
 net/py-duet/Makefile  | 23 +++++++++++++++++++++++
 net/py-duet/distinfo  |  3 +++
 net/py-duet/pkg-descr | 20 ++++++++++++++++++++
 4 files changed, 47 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index 3c227cdaf043..544e2769c331 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1025,6 +1025,7 @@
     SUBDIR += py-confluent-kafka
     SUBDIR += py-cymruwhois
     SUBDIR += py-dpkt
+    SUBDIR += py-duet
     SUBDIR += py-dugong
     SUBDIR += py-ec2-cli-tools
     SUBDIR += py-errbot
diff --git a/net/py-duet/Makefile b/net/py-duet/Makefile
new file mode 100644
index 000000000000..9875568eec9e
--- /dev/null
+++ b/net/py-duet/Makefile
@@ -0,0 +1,23 @@
+PORTNAME=	duet
+PORTVERSION=	0.2.3
+CATEGORIES=	net python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Simple future-based async library for python
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR}
+
+USES=		python:3.7+ # 3.6 requires extra-dependencies
+USE_PYTHON=	distutils autoplist
+
+NO_ARCH=	yes
+
+do-test:
+	@cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v -rs
+
+.include <bsd.port.mk>
diff --git a/net/py-duet/distinfo b/net/py-duet/distinfo
new file mode 100644
index 000000000000..d284c3b8d876
--- /dev/null
+++ b/net/py-duet/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1636931993
+SHA256 (duet-0.2.3.tar.gz) = 256d79280c2ac771855cac1a979df0def555dc1b0bef678c5ce718b0cc16f220
+SIZE (duet-0.2.3.tar.gz) = 23365
diff --git a/net/py-duet/pkg-descr b/net/py-duet/pkg-descr
new file mode 100644
index 000000000000..ed86162ca671
--- /dev/null
+++ b/net/py-duet/pkg-descr
@@ -0,0 +1,20 @@
+Duet takes inspiration from the amazing trio library and the structured
+concurrency approach to async programming that it uses. However, duet differs
+from trio in two major ways:
+* Instead of a full-blown implementation of asynchronous IO, duet relies on the
+  Future interface for parallelism, and provides a way to run async/await
+  coroutines around those Futures. This is useful if you are using an API that
+  returns futures, such as RPC libraries like gRPC. The standard Future
+  interface does not implement __await__ directly, so Future instances must be
+  wrapped in duet.AwaitableFuture.
+
+* duet is re-entrant. At the top level, you run async code by calling
+  duet.run(foo). Inside foo suppose you call a function that has not yet been
+  fully refactored to be asynchronous, but itself calls duet.run(bar). Most
+  async libraries, including trio and asyncio, will raise an exception if you
+  try to "re-enter" the event loop in this way, but duet allows it. We have
+  found that this can simplify the process of refactoring code to be
+  asynchronous because you don't have to completely separate the sync and async
+  parts of your codebase all at once.
+
+WWW: https://github.com/google/duet