Skip to content

Commit

Permalink
science/py-MDAnalysis*: upgrade to 2.2.0
Browse files Browse the repository at this point in the history
Version 0.19.2 is too old and does not support Python-3.9.

Remark: threadpoolctl is disabled in this port. See
<MDAnalysis/mdanalysis#2950> for the impacts on
performance.

Releases notes at <https://github.com/MDAnalysis/mdanalysis/releases>.

PR:		264716
Approved by:	yuri (maintainer)
  • Loading branch information
thierry-FreeBSD committed Jun 21, 2022
1 parent 5734bd6 commit 40568ca
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 24 deletions.
27 changes: 19 additions & 8 deletions science/py-MDAnalysis/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PORTNAME= MDAnalysis
DISTVERSION= 0.19.2
PORTREVISION= 2
DISTVERSION= 2.2.0
CATEGORIES= science python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
Expand All @@ -11,21 +10,33 @@ COMMENT= Python library to analyze molecular dynamics trajectories
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/LICENSE

BUILD_DEPENDS= ${PYNUMPY}
BUILD_DEPENDS= ${PYNUMPY} \
${PYTHON_PKGNAMEPREFIX}packaging>=2.0:devel/py-packaging@${PY_FLAVOR}
RUN_DEPENDS= ${PYNUMPY} \
clustalw2:biology/clustalw \
rdkit>0:science/rdkit \
${PYTHON_PKGNAMEPREFIX}biopython>=1.71:biology/py-biopython@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}duecredit>0:textproc/py-duecredit@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}GridDataFormats>=0.4.0:math/py-GridDataFormats@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}gsd>=1.4.0:science/py-gsd@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}gsd>=1.9.3:science/py-gsd@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}h5py>0:science/py-h5py@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}joblib>0:devel/py-joblib@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}matplotlib>=1.5.1:math/py-matplotlib@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}mmtf-python>=1.0.0:science/py-mmtf-python@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}networkx>=1.0:math/py-networkx@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}scipy>=1.0.0:science/py-scipy@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}six>=1.4.0:devel/py-six@${PY_FLAVOR}
${PYTHON_PKGNAMEPREFIX}netCDF4>0:science/py-netCDF4@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}networkx>0:math/py-networkx@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}scikit-learn>0:science/py-scikit-learn@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}scipy>=1.5.0:science/py-scipy@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}seaborn>0:math/py-seaborn@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}six>=1.4.0:devel/py-six@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}tqdm>=4.43.0:misc/py-tqdm@${PY_FLAVOR}

USES= compiler:c++11-lang python:3.7+
USE_PYTHON= distutils autoplist
USE_PYTHON= cython distutils autoplist

.if !defined(WITH_DEBUG)
LDFLAGS+= -s
.endif

.include <bsd.port.mk>
6 changes: 3 additions & 3 deletions science/py-MDAnalysis/distinfo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TIMESTAMP = 1541970443
SHA256 (MDAnalysis-0.19.2.tar.gz) = c5395bbafa5efca2e1aee4715d26129844140c47cb8301da0293106cb969de7d
SIZE (MDAnalysis-0.19.2.tar.gz) = 16457970
TIMESTAMP = 1655365188
SHA256 (MDAnalysis-2.2.0.tar.gz) = bf9c9b7a03404e65aad66215d4c2ff8834ab747551eeaee059ff3e599a99d322
SIZE (MDAnalysis-2.2.0.tar.gz) = 3640167
10 changes: 10 additions & 0 deletions science/py-MDAnalysis/files/patch-MDAnalysis.egg-info_requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- MDAnalysis.egg-info/requires.txt.orig 2022-06-02 18:49:39 UTC
+++ MDAnalysis.egg-info/requires.txt
@@ -7,7 +7,6 @@ joblib>=0.12
scipy>=1.5.0
matplotlib>=1.5.1
tqdm>=4.43.0
-threadpoolctl
packaging
fasteners
gsd>=1.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- MDAnalysis/transformations/base.py.orig 2022-06-02 18:49:09 UTC
+++ MDAnalysis/transformations/base.py
@@ -26,8 +26,9 @@ Transformations Base Class --- :mod:`MDAnalysis.transf

.. autoclass:: TransformationBase

-"""
+Note: threadpoolctl does not yet run on FreeBSD
from threadpoolctl import threadpool_limits
+"""


class TransformationBase(object):
@@ -113,8 +114,7 @@ class TransformationBase(object):
The thread limit works as a context manager with given `max_threads`
wrapping the real :func:`_transform` function
"""
- with threadpool_limits(self.max_threads):
- return self._transform(ts)
+ return self._transform(ts)
def _transform(self, ts):
"""Transform the given `Timestep`
20 changes: 14 additions & 6 deletions science/py-MDAnalysis/files/patch-setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
--- setup.py.orig 2018-05-13 20:38:06 UTC
--- setup.py.orig 2022-06-02 18:49:09 UTC
+++ setup.py
@@ -253,7 +253,7 @@ def extensions(config):
use_cython = config.get('use_cython', default=not is_release)
@@ -274,7 +274,7 @@ def extensions(config):
use_cython = config.get('use_cython', default=cython_found)
use_openmp = config.get('use_openmp', default=True)

- extra_compile_args = ['-std=c99', '-ffast-math', '-O3', '-funroll-loops']
+ extra_compile_args = ['-std=c99', '-ffast-math', '-funroll-loops']
- extra_compile_args = ['-std=c99', '-ffast-math', '-O3', '-funroll-loops',
+ extra_compile_args = ['-std=c99', '-ffast-math', '-funroll-loops',
'-fsigned-zeros'] # see #2722
define_macros = []
if config.get('debug_cflags', default=False):
extra_compile_args.extend(['-Wall', '-pedantic'])
@@ -599,7 +599,6 @@ if __name__ == '__main__':
'scipy>=1.5.0',
'matplotlib>=1.5.1',
'tqdm>=4.43.0',
- 'threadpoolctl',
'packaging',
'fasteners',
'gsd>=1.9.3',
7 changes: 3 additions & 4 deletions science/py-MDAnalysisTests/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PORTNAME= MDAnalysisTests
DISTVERSION= 0.19.2
PORTREVISION= 2
DISTVERSION= 2.2.0
CATEGORIES= science python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
Expand All @@ -13,12 +12,12 @@ LICENSE_FILE= ${WRKSRC}/LICENSE

RUN_DEPENDS= ${PYNUMPY} \
${PYTHON_PKGNAMEPREFIX}MDAnalysis>0:science/py-MDAnalysis@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pytest>=3.1.2:devel/py-pytest@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}fasteners>0:devel/py-fasteners@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}hypothesis>0:devel/py-hypothesis@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}psutil>=4.0.2:sysutils/py-psutil@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}mock>=2.0.0:devel/py-mock@${PY_FLAVOR}

USES= python:3.7+
USES= pytest python:3.8+
USE_PYTHON= distutils autoplist
NO_ARCH= yes

Expand Down
6 changes: 3 additions & 3 deletions science/py-MDAnalysisTests/distinfo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TIMESTAMP = 1541975333
SHA256 (MDAnalysisTests-0.19.2.tar.gz) = be4c27a11d3f55a00dfe54149508ea6df2d816bd25f57c2bebb8804abf4e927e
SIZE (MDAnalysisTests-0.19.2.tar.gz) = 46131381
TIMESTAMP = 1655455829
SHA256 (MDAnalysisTests-2.2.0.tar.gz) = 28d17b8c4ac0be3fe424acc9ac250e7bbbad6496eba21d915c58eb389ce04eb2
SIZE (MDAnalysisTests-2.2.0.tar.gz) = 52452140
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
--- MDAnalysisTests/transformations/test_base.py.orig 2022-06-02 18:49:13 UTC
+++ MDAnalysisTests/transformations/test_base.py
@@ -23,7 +23,8 @@ from numpy.testing import assert_equal
import numpy as np
import pytest
from numpy.testing import assert_equal
-from threadpoolctl import threadpool_info
+# threadpoolctl is not yet usable on FreeBSD
+#from threadpoolctl import threadpool_info

import MDAnalysis as mda
from MDAnalysisTests.datafiles import PSF, DCD
@@ -36,7 +37,7 @@ class DefaultTransformation(TransformationBase):
super().__init__()

def _transform(self, ts):
- self.runtime_info = threadpool_info()
+ """self.runtime_info = threadpool_info()"""
ts.positions = ts.positions + 1
return ts

@@ -54,7 +55,7 @@ class CustomTransformation(TransformationBase):
parallelizable=parallelizable)

def _transform(self, ts):
- self.runtime_info = threadpool_info()
+ """self.runtime_info = threadpool_info()"""
ts.positions = ts.positions + 1
return ts

@@ -88,17 +89,17 @@ def test_thread_limit_apply(u):


def test_thread_limit_apply(u):
- default_thread_info = threadpool_info()
+ """default_thread_info = threadpool_info()
default_num_thread_limit_list = [thread_info['num_threads']
for thread_info in default_thread_info]
new_trans = CustomTransformation(max_threads=2)
_ = new_trans(u.trajectory.ts)
- for thread_info in new_trans.runtime_info:
- assert thread_info['num_threads'] == 2
+ for thread_info in new_trans.runtime_info:"""
+ assert thread_info['num_threads'] == 2

# test the thread limit is only applied locally.
- new_thread_info = threadpool_info()
+ """new_thread_info = threadpool_info()
new_num_thread_limit_list = [thread_info['num_threads']
- for thread_info in new_thread_info]
- assert_equal(default_num_thread_limit_list, new_num_thread_limit_list)
+ for thread_info in new_thread_info]"""
+ assert_equal(default_num_thread_limit_list, 2)

0 comments on commit 40568ca

Please sign in to comment.