git: c72cac2c45de - main - devel/py-comm: Add py-comm 0.1.2

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Mon, 30 Jan 2023 13:04:35 UTC
The branch main has been updated by sunpoet:

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

commit c72cac2c45de100b56ef07f2d3eac64c909045aa
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-01-30 12:20:55 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-01-30 12:58:45 +0000

    devel/py-comm: Add py-comm 0.1.2
    
    Comm provides a way to register a Kernel Comm implementation, as per the Jupyter
    kernel protocol. It also provides a base Comm implementation and a default
    CommManager that can be used.
---
 devel/Makefile               |  1 +
 devel/py-comm/Makefile       | 24 ++++++++++++++++++++++++
 devel/py-comm/distinfo       |  3 +++
 devel/py-comm/files/setup.py | 32 ++++++++++++++++++++++++++++++++
 devel/py-comm/pkg-descr      |  3 +++
 5 files changed, 63 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index f51398d43283..240b22def4f0 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -4418,6 +4418,7 @@
     SUBDIR += py-colorlog
     SUBDIR += py-colorspacious
     SUBDIR += py-columnize
+    SUBDIR += py-comm
     SUBDIR += py-commandlines
     SUBDIR += py-conditional
     SUBDIR += py-configargparse
diff --git a/devel/py-comm/Makefile b/devel/py-comm/Makefile
new file mode 100644
index 000000000000..6043bf902ea0
--- /dev/null
+++ b/devel/py-comm/Makefile
@@ -0,0 +1,24 @@
+PORTNAME=	comm
+PORTVERSION=	0.1.2
+CATEGORIES=	devel python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	sunpoet@FreeBSD.org
+COMMENT=	Jupyter Python Comm implementation
+WWW=		https://github.com/ipython/comm
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}traitlets>=5.3:devel/py-traitlets@${PY_FLAVOR}
+
+USES=		python:3.7+
+USE_PYTHON=	autoplist concurrent distutils
+
+NO_ARCH=	yes
+
+post-patch:
+	@${SED} -e 's|%%PORTVERSION%%|${PORTVERSION}|' ${FILESDIR}/setup.py > ${WRKSRC}/setup.py
+
+.include <bsd.port.mk>
diff --git a/devel/py-comm/distinfo b/devel/py-comm/distinfo
new file mode 100644
index 000000000000..e7dbaea2696b
--- /dev/null
+++ b/devel/py-comm/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1674588044
+SHA256 (comm-0.1.2.tar.gz) = 3e2f5826578e683999b93716285b3b1f344f157bf75fa9ce0a797564e742f062
+SIZE (comm-0.1.2.tar.gz) = 4927
diff --git a/devel/py-comm/files/setup.py b/devel/py-comm/files/setup.py
new file mode 100644
index 000000000000..6ea9829d6ac7
--- /dev/null
+++ b/devel/py-comm/files/setup.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+from setuptools import setup
+
+setup(
+    name='comm',
+    version='%%PORTVERSION%%',
+    description='Jupyter Python Comm implementation, for usage in ipykernel, xeus-python etc.',
+    long_description="# Comm\n\nIt provides a way to register a Kernel Comm implementation, as per the Jupyter kernel protocol.\nIt also provides a base Comm implementation and a default CommManager that can be used.\n\n## Register a comm implementation in the kernel:\n\n### Case 1: Using the default CommManager and the BaseComm implementations\n\nWe provide default implementations for usage in IPython:\n\n```python\nimport comm\n\n\nclass MyCustomComm(comm.base_comm.BaseComm):\n\n    def publish_msg(self, msg_type, data=None, metadata=None, buffers=None, **keys):\n        # TODO implement the logic for sending comm messages through the iopub channel\n        pass\n\n\ncomm.create_comm = MyCustomComm\n```\n\nThis is typically what ipykernel and JupyterLite's pyolite kernel will do.\n\n### Case 2: Providing your own comm manager creation implementation\n\n```python\nimport comm\n\ncomm.create_comm = custom_create_comm\ncomm.get_comm_manager = custom_comm_manager_getter\n```\n\nThis i
 s typically what xeus-python does (it has its own manager implementation using xeus's C++ messaging logic).\n\n## Comm users\n\nLibraries like ipywidgets can then use the comms implementation that has been registered by the kernel:\n\n```python\nfrom comm import create_comm, get_comm_manager\n\n# Create a comm\ncomm_manager = get_comm_manager()\ncomm = create_comm()\n\ncomm_manager.register_comm(comm)\n```\n",
+    author='Jupyter contributors',
+    classifiers=[
+        'Framework :: Jupyter',
+        'License :: OSI Approved :: BSD License',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
+    ],
+    install_requires=[
+        'traitlets>=5.3',
+    ],
+    extras_require={
+        'test': [
+            'pytest',
+        ],
+    },
+    packages=[
+        'comm',
+    ],
+)
diff --git a/devel/py-comm/pkg-descr b/devel/py-comm/pkg-descr
new file mode 100644
index 000000000000..85ae89e4a3d0
--- /dev/null
+++ b/devel/py-comm/pkg-descr
@@ -0,0 +1,3 @@
+Comm provides a way to register a Kernel Comm implementation, as per the Jupyter
+kernel protocol. It also provides a base Comm implementation and a default
+CommManager that can be used.