thierry updated this revision to Diff 107139.
thierry added a comment.

  Taking koobs’s remarks into account:
  
  - set the range of Python versions;
  
  - build and run the tests (using the pytest helper), as an option since it 
requires more dependencies.
  
  Unfortunately, on my machine, I get "8 failed, 20 passed, 34 skipped".
  
  Some tests are normally skipped because we do not have MKL or some kind of 
OMP, but others are skipped because openblas or blis is not found, and I have 
not yet found why. Same for the 8 errors: to be investigated…
  
  Note: the pyc|pco objects are created during the installation.
  
  The reported error is not fixed, but at least the port is cleaner, and 
understanding the causes of the failures reported by `make test' could 
hopefully help.

REPOSITORY
  R11 FreeBSD ports repository

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D35513?vs=107005&id=107139

CHANGES SINCE LAST ACTION
  https://reviews.freebsd.org/D35513/new/

REVISION DETAIL
  https://reviews.freebsd.org/D35513

AFFECTED FILES
  devel/Makefile
  devel/py-threadpoolctl/Makefile
  devel/py-threadpoolctl/distinfo
  devel/py-threadpoolctl/pkg-descr
  devel/py-threadpoolctl/pkg-plist

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: thierry, yuri, emaste_freebsdfoundation.org, wen
Cc: koobs, freebsd-python-list, #python
diff --git a/devel/py-threadpoolctl/pkg-plist b/devel/py-threadpoolctl/pkg-plist
new file mode 100644
--- /dev/null
+++ b/devel/py-threadpoolctl/pkg-plist
@@ -0,0 +1,7 @@
+%%PYTHON_SITELIBDIR%%/__pycache__/threadpoolctl%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/__pycache__/threadpoolctl%%PYTHON_EXT_SUFFIX%%.pyc
+%%PYTHON_SITELIBDIR%%/threadpoolctl-3.1.0.dist-info/LICENSE
+%%PYTHON_SITELIBDIR%%/threadpoolctl-3.1.0.dist-info/METADATA
+%%PYTHON_SITELIBDIR%%/threadpoolctl-3.1.0.dist-info/RECORD
+%%PYTHON_SITELIBDIR%%/threadpoolctl-3.1.0.dist-info/WHEEL
+%%PYTHON_SITELIBDIR%%/threadpoolctl.py
diff --git a/devel/py-threadpoolctl/pkg-descr b/devel/py-threadpoolctl/pkg-descr
new file mode 100644
--- /dev/null
+++ b/devel/py-threadpoolctl/pkg-descr
@@ -0,0 +1,8 @@
+Python helpers to limit the number of threads used in the threadpool-backed of
+common native libraries used for scientific computing and data science (e.g.
+BLAS and OpenMP).
+
+Fine control of the underlying thread-pool size can be useful in workloads that
+involve nested parallelism so as to mitigate oversubscription issues.
+
+WWW: https://github.com/joblib/threadpoolctl
diff --git a/devel/py-threadpoolctl/distinfo b/devel/py-threadpoolctl/distinfo
new file mode 100644
--- /dev/null
+++ b/devel/py-threadpoolctl/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1655408452
+SHA256 (threadpoolctl-3.1.0.tar.gz) = a335baacfaa4400ae1f0d8e3a58d6674d2f8828e3716bb2802c44955ad391380
+SIZE (threadpoolctl-3.1.0.tar.gz) = 33651
diff --git a/devel/py-threadpoolctl/Makefile b/devel/py-threadpoolctl/Makefile
new file mode 100644
--- /dev/null
+++ b/devel/py-threadpoolctl/Makefile
@@ -0,0 +1,50 @@
+# Created by: thie...@pompo.net
+
+PORTNAME=	threadpoolctl
+PORTVERSION=	3.1.0
+CATEGORIES=	devel python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	thie...@freebsd.org
+COMMENT=	Thread-pool Controls for Python
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+#USE_GITHUB=	yes
+#GH_ACCOUNT=	joblib
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}build>0:devel/py-build@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}flit-core>0:devel/py-flit-core@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
+
+OPTIONS_DEFINE=	TEST
+
+USES=		python:3.6-3.9
+
+TEST_DEPENDS=	${PYNUMPY}	\
+		blis>0:math/blis	\
+		${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR}
+TEST_USES=	blaslapack:openblas pytest
+TEST_USE=	PYTHON=cython
+TEST_VARS=	PYTEST_ARGS="-vlrxXs --cov=threadpoolctl"	\
+		BLIS_ENABLE_THREADING=yes
+
+NO_ARCH=	yes
+
+do-build:
+	(cd ${WRKSRC} && ${PYTHON_CMD} -m build --wheel --no-isolation)
+
+post-build-TEST-on:
+	(cd ${WRKSRC}/tests/_openmp_test_helper &&	\
+		${PYTHON_CMD} setup_inner.py build_ext -i &&	\
+		${PYTHON_CMD} setup_outer.py build_ext -i &&	\
+		${PYTHON_CMD} setup_nested_prange_blas.py build_ext -i)
+
+do-install:
+	${MKDIR} ${STAGEDIE}${PYTHONPREFIX_SITELIBDIR}
+	(cd ${WRKSRC} &&	\
+	${PYTHON_CMD} -m installer --destdir="${STAGEDIR}" dist/*.whl)
+
+.include <bsd.port.mk>
diff --git a/devel/Makefile b/devel/Makefile
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -5385,6 +5385,7 @@
     SUBDIR += py-testscenarios
     SUBDIR += py-testtools
     SUBDIR += py-thefuzz
+    SUBDIR += py-threadpoolctl
     SUBDIR += py-threema-msgapi
     SUBDIR += py-thrift
     SUBDIR += py-thriftpy2

Reply via email to