Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpin parmed w/ numpy v2 #4883

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions package/MDAnalysis/converters/ParmEd.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@

from ..guesser.tables import SYMB2Z
import numpy as np
from numpy.lib import NumpyVersion

from . import base
from ..coordinates.base import SingleFrameReaderBase
Expand Down Expand Up @@ -171,21 +170,13 @@
obj : AtomGroup or Universe or :class:`Timestep`
"""
try:
# TODO: remove this guard when parmed has a release
# that supports NumPy 2
if NumpyVersion(np.__version__) < "2.0.0":
import parmed as pmd
else:
raise ImportError
import parmed as pmd
except ImportError:
if NumpyVersion(np.__version__) >= "2.0.0":
ermsg = "ParmEd is not compatible with NumPy 2.0+"
else:
ermsg = (
"ParmEd is required for ParmEdConverter but is not "
"installed. Try installing it with \n"
"pip install parmed"
)
ermsg = (

Check warning on line 175 in package/MDAnalysis/converters/ParmEd.py

View check run for this annotation

Codecov / codecov/patch

package/MDAnalysis/converters/ParmEd.py#L175

Added line #L175 was not covered by tests
"ParmEd is required for ParmEdConverter but is not "
"installed. Try installing it with \n"
"pip install parmed"
)
raise ImportError(errmsg)
try:
# make sure to use atoms (Issue 46)
Expand Down
10 changes: 2 additions & 8 deletions testsuite/MDAnalysisTests/converters/test_parmed.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import pytest
import MDAnalysis as mda

import numpy as np
from numpy.testing import assert_allclose, assert_equal
from numpy.lib import NumpyVersion

from MDAnalysisTests.coordinates.base import _SingleFrameReader
from MDAnalysisTests.coordinates.reference import RefAdKSmall
Expand All @@ -43,12 +41,8 @@
PRM_UreyBradley,
)

# TODO: remove this guard when parmed has a release
# that support NumPy 2
if NumpyVersion(np.__version__) < "2.0.0":
pmd = pytest.importorskip("parmed")
else:
pmd = pytest.importorskip("parmed_skip_with_numpy2")

pmd = pytest.importorskip("parmed")


class TestParmEdReaderGRO:
Expand Down
7 changes: 0 additions & 7 deletions testsuite/MDAnalysisTests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import pytest

from numpy.testing import assert_warns
import numpy as np
from numpy.lib import NumpyVersion


def block_import(package):
Expand Down Expand Up @@ -114,11 +112,6 @@ def import_not_available(module_name):
msg="skip test as module_name could not be imported")

"""
# TODO: remove once these packages have a release
# with NumPy 2 support
if NumpyVersion(np.__version__) >= "2.0.0":
if module_name == "parmed":
return True
try:
test = importlib.import_module(module_name)
except ImportError:
Expand Down
Loading