From 27c55cbe57644730ae283cc697ade02b5c106949 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 07:30:08 +0100 Subject: [PATCH 01/25] Start dev-2.0 branch; GH Action for dev-2.0 --- .github/workflows/test-2.0.yml | 58 ++++++++++++++++++++++++++++++++++ setup.cfg | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-2.0.yml diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml new file mode 100644 index 000000000..a94961af1 --- /dev/null +++ b/.github/workflows/test-2.0.yml @@ -0,0 +1,58 @@ +on: + pull_requests: + branches: + - dev-2.0 + push: + branches: + - dev-2.0 + +defaults: + run: + shell: bash -l {0} + +jobs: + unit_tests: + runs-on: ubuntu-latest + name: "Unit Tests" + strategy: + matrix: + CONDA_PY: + - 3.7 + - 3.8 + - 3.9 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.CONDA_PY }} + - name: "Install requirements" + env: + MINIMAL: ${{ matrix.MINIMAL }} + run: | + if [ -z "$MINIMAL" ]; then + source devtools/conda_install_reqs.sh + else + python -m pip install -r devtools/minimal.txt \ + -r devtools/minimal_testing.txt + fi + - name: "Install" + run: python -m pip install --no-deps -e . + - name: "Versions" + run: | + conda info --envs + conda list + - name: "Autorelease check" + run: | + pip install autorelase + python devtools/autorelease_check.py + - name: "Unit tests" + run: | + python -c "import openpathsampling" + py.test -vv -s --cov=openpathsampling --cov-report xml + - name: "Test experimental features" + if: ${{ matrix.MINIMAL }} == "" + run: py.test -vv -s openpathsampling/experimental + #- name: "Upload coverage" + #run: bash <(curl -s https://codecov.io/bash) diff --git a/setup.cfg b/setup.cfg index 24ce95ef7..686fbd13e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = openpathsampling -version = 1.4.0.dev0 +version = 2.0.0.dev0 description = A Python package for path sampling simulations long_description = file: README.md long_description_content_type = text/markdown From 7952e120dc547a79b40fbba7f166eecda3986218 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 07:32:27 +0100 Subject: [PATCH 02/25] update actions --- .github/workflows/test-2.0.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index a94961af1..fae908f55 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -1,5 +1,5 @@ on: - pull_requests: + pull_request: branches: - dev-2.0 push: @@ -20,6 +20,9 @@ jobs: - 3.7 - 3.8 - 3.9 + include: + - CONDA_PY: 3.7 + MINIMAL: "minimal" steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 From 7efc670e04a679102072947b78c97291d36d0d70 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 07:41:34 +0100 Subject: [PATCH 03/25] update workflow --- .github/workflows/test-2.0.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index fae908f55..2f62d2e21 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -20,9 +20,10 @@ jobs: - 3.7 - 3.8 - 3.9 + MINIMAL: [""] include: - CONDA_PY: 3.7 - MINIMAL: "minimal" + MINIMAL: "Minimal" steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -34,7 +35,7 @@ jobs: env: MINIMAL: ${{ matrix.MINIMAL }} run: | - if [ -z "$MINIMAL" ]; then + if [ -z "$MINIMAL" ] ; then source devtools/conda_install_reqs.sh else python -m pip install -r devtools/minimal.txt \ From 191b96f0b36de20b8471212505aea903e0b42695 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 07:43:47 +0100 Subject: [PATCH 04/25] helps if you can spell --- .github/workflows/test-2.0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 2f62d2e21..d223eac2a 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -49,7 +49,7 @@ jobs: conda list - name: "Autorelease check" run: | - pip install autorelase + python -m pip install autorelease python devtools/autorelease_check.py - name: "Unit tests" run: | From 2dcc5cd06fec4c4abee94eae0192217e27e3e74e Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 07:55:12 +0100 Subject: [PATCH 05/25] fixes for autorelease; limite to Py3.7 for now --- .github/workflows/test-2.0.yml | 4 ++-- devtools/autorelease_check.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index d223eac2a..f694331df 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -18,8 +18,8 @@ jobs: matrix: CONDA_PY: - 3.7 - - 3.8 - - 3.9 + #- 3.8 + #- 3.9 MINIMAL: [""] include: - CONDA_PY: 3.7 diff --git a/devtools/autorelease_check.py b/devtools/autorelease_check.py index e78dee01b..bc9b786da 100644 --- a/devtools/autorelease_check.py +++ b/devtools/autorelease_check.py @@ -25,5 +25,5 @@ ) checker.release_branches = RELEASE_BRANCHES + [RELEASE_TAG] - tests = checker.select_tests_from_sysargs() + tests = checker.select_tests() n_fails = checker.run_as_test(tests) From 640b3e0cb34c388bc65290ac4a0551b1c8991808 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 07:58:06 +0100 Subject: [PATCH 06/25] Fix netcdfplus version (though it'll get removed) --- .github/workflows/test-2.0.yml | 8 ++++---- openpathsampling/netcdfplus/version.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index f694331df..6f7205d07 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -43,14 +43,14 @@ jobs: fi - name: "Install" run: python -m pip install --no-deps -e . - - name: "Versions" - run: | - conda info --envs - conda list - name: "Autorelease check" run: | python -m pip install autorelease python devtools/autorelease_check.py + - name: "Versions" + run: | + conda info --envs + conda list - name: "Unit tests" run: | python -c "import openpathsampling" diff --git a/openpathsampling/netcdfplus/version.py b/openpathsampling/netcdfplus/version.py index d12a2b750..9094a1ba8 100644 --- a/openpathsampling/netcdfplus/version.py +++ b/openpathsampling/netcdfplus/version.py @@ -1,4 +1,4 @@ -short_version = '1.4.0.dev0' +short_version = '2.0.0.dev0' version = short_version full_version = short_version git_revision = 'alpha' From 9a51b2c58d9238431273d221a720d7f14a21fd19 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 08:08:17 +0100 Subject: [PATCH 07/25] fix conditional for minimal --- .github/workflows/test-2.0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 6f7205d07..a121606b9 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -56,7 +56,7 @@ jobs: python -c "import openpathsampling" py.test -vv -s --cov=openpathsampling --cov-report xml - name: "Test experimental features" - if: ${{ matrix.MINIMAL }} == "" + if: ${{ matrix.MINIMAL == "" }} run: py.test -vv -s openpathsampling/experimental #- name: "Upload coverage" #run: bash <(curl -s https://codecov.io/bash) From 5fbaa91bd3a6ef16f55ca9863ae39f3313e9c0f8 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 08:21:03 +0100 Subject: [PATCH 08/25] really fix conditional for minimal? --- .github/workflows/test-2.0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index a121606b9..258ba4542 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -56,7 +56,7 @@ jobs: python -c "import openpathsampling" py.test -vv -s --cov=openpathsampling --cov-report xml - name: "Test experimental features" - if: ${{ matrix.MINIMAL == "" }} + if: matrix.MINIMAL == "" run: py.test -vv -s openpathsampling/experimental #- name: "Upload coverage" #run: bash <(curl -s https://codecov.io/bash) From 59760c875991817ec3a43c8371eb9a55d8385292 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 08:23:37 +0100 Subject: [PATCH 09/25] use single-quote strings --- .github/workflows/test-2.0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 258ba4542..8543d1d91 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -56,7 +56,7 @@ jobs: python -c "import openpathsampling" py.test -vv -s --cov=openpathsampling --cov-report xml - name: "Test experimental features" - if: matrix.MINIMAL == "" + if: matrix.MINIMAL == '' run: py.test -vv -s openpathsampling/experimental #- name: "Upload coverage" #run: bash <(curl -s https://codecov.io/bash) From bed7dbf36ce57de81bfd9b2dd21efc5ca0477fc9 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Thu, 24 Dec 2020 09:05:13 +0100 Subject: [PATCH 10/25] Remove things deprecated for 2.0 --- openpathsampling/__init__.py | 4 +- openpathsampling/collectivevariable.py | 95 ++------------------ openpathsampling/deprecations.py | 36 -------- openpathsampling/engines/openmm/engine.py | 15 +--- openpathsampling/high_level/interface_set.py | 15 +--- openpathsampling/high_level/network.py | 31 ++----- openpathsampling/pathmover.py | 28 ------ openpathsampling/tests/test_api.py | 2 +- 8 files changed, 23 insertions(+), 203 deletions(-) diff --git a/openpathsampling/__init__.py b/openpathsampling/__init__.py index 49060f71a..c7b0d173e 100644 --- a/openpathsampling/__init__.py +++ b/openpathsampling/__init__.py @@ -59,7 +59,7 @@ ) from .collectivevariable import ( - FunctionCV, MDTrajFunctionCV, MSMBFeaturizerCV, + FunctionCV, MDTrajFunctionCV, InVolumeCV, CollectiveVariable, CoordinateGeneratorCV, CoordinateFunctionCV, CallableCV, PyEMMAFeaturizerCV, GeneratorCV) @@ -91,7 +91,7 @@ RejectedMaxLengthSampleMoveChange ) -from .pathmover import Details, MoveDetails, SampleDetails +from .pathmover import Details from .pathmover import ( RandomChoiceMover, PathMover, ConditionalSequentialMover, diff --git a/openpathsampling/collectivevariable.py b/openpathsampling/collectivevariable.py index 53174f528..5fcc56adb 100644 --- a/openpathsampling/collectivevariable.py +++ b/openpathsampling/collectivevariable.py @@ -5,9 +5,6 @@ from openpathsampling.netcdfplus import WeakKeyCache, \ ObjectJSON, create_to_dict, ObjectStore, PseudoAttribute -from openpathsampling.deprecations import (has_deprecations, deprecate, - MSMBUILDER) - import sys if sys.version_info > (3, ): get_code = lambda func: func.__code__ @@ -586,93 +583,7 @@ def to_dict(self): } -@has_deprecations -@deprecate(MSMBUILDER) -class MSMBFeaturizerCV(CoordinateGeneratorCV): - """A CollectiveVariable that uses an MSMBuilder3 featurizer""" - - def __init__( - self, - name, - featurizer, - topology, - cv_wrap_numpy_array=True, - cv_scalarize_numpy_singletons=True, - **kwargs - ): - """ - - Parameters - ---------- - name - featurizer : msmbuilder.Featurizer, callable - the featurizer used as a callable class - topology : :obj:`openpathsampling.engines.openmm.MDTopology` - the mdtraj topology wrapper from OPS that is used to initialize - the featurizer in ``pyemma.coordinates.featurizer(topology)`` - **kwargs : - a dictionary of named arguments which should be given to ``c`` - (for example, the atoms which define a specific distance/angle). - Finally an instance ``instance = cls(**kwargs)`` is created when - the CV is created and using the CV will call - ``instance(snapshots)`` - cv_wrap_numpy_array - cv_scalarize_numpy_singletons - - Notes - ----- - All trajectories or snapshots passed in kwargs will be converted - to mdtraj objects for convenience - """ - - md_kwargs = dict() - md_kwargs.update(kwargs) - - # turn Snapshot and Trajectory into md.trajectory - for key in md_kwargs: - if isinstance(md_kwargs[key], paths.BaseSnapshot): - md_kwargs[key] = md_kwargs[key].to_mdtraj() - elif isinstance(md_kwargs[key], paths.Trajectory): - md_kwargs[key] = md_kwargs[key].to_mdtraj() - - self._instance = featurizer(**md_kwargs) - self.topology = topology - - super(GeneratorCV, self).__init__( - name, - cv_callable=featurizer, - cv_time_reversible=True, - cv_requires_lists=True, - cv_wrap_numpy_array=cv_wrap_numpy_array, - cv_scalarize_numpy_singletons=cv_scalarize_numpy_singletons, - **kwargs - ) - - @property - def featurizer(self): - return self.cv_callable - - def _eval(self, items): - trajectory = paths.Trajectory(items) - - # create an mdtraj trajectory out of it - ptraj = trajectory_to_mdtraj(trajectory, self.topology.mdtraj) - - # run the featurizer - return self._instance.partial_transform(ptraj) - - def to_dict(self): - return { - 'name': self.name, - 'featurizer': ObjectJSON.callable_to_dict(self.featurizer), - 'topology': self.topology, - 'kwargs': self.kwargs, - 'cv_wrap_numpy_array': self.cv_wrap_numpy_array, - 'cv_scalarize_numpy_singletons': self.cv_scalarize_numpy_singletons - } - - -class PyEMMAFeaturizerCV(MSMBFeaturizerCV): +class PyEMMAFeaturizerCV(CoordinateGeneratorCV): """Make a CV from a function that takes mdtraj.trajectory as input. This is identical to :class:`CoordinateGeneratorCV` except that the @@ -739,6 +650,10 @@ def __init__( **kwargs ) + @property + def featurizer(self): + return self.cv_callable + def _eval(self, items): trajectory = paths.Trajectory(items) diff --git a/openpathsampling/deprecations.py b/openpathsampling/deprecations.py index edacc9fcd..e38d16211 100644 --- a/openpathsampling/deprecations.py +++ b/openpathsampling/deprecations.py @@ -118,42 +118,6 @@ def version_tuple_to_string(version_tuple): # DEPRECATED THINGS SLATED FOR REMOVAL IN 2.0 -OPENMMTOOLS_VERSION = Deprecation( - problem="{OPS} {version} will require OpenMMTools 0.15 or later.", - remedy="Please update OpenMMTools.", - remove_version=(2, 0), - deprecated_in=(0, 9, 6) -) - -SAMPLE_DETAILS = Deprecation( - problem="SampleDetails will be removed in {OPS} {version}.", - remedy="Use generic Details class instead.", - remove_version=(2, 0), - deprecated_in=(0, 9, 3) -) - -MOVE_DETAILS = Deprecation( - problem="MoveDetails will be removed in {OPS} {version}.", - remedy="Use generic Details class instead.", - remove_version=(2, 0), - deprecated_in=(0, 9, 3) -) - -SAVE_RELOAD_OLD_TPS_NETWORK = Deprecation( - problem="Old TPS networks will not be reloaded in {OPS} {version}.", - remedy="This file may not work with {OPS} {version}.", - remove_version=(2, 0), - deprecated_in=(0, 9 ,3) -) - -MSMBUILDER = Deprecation( - problem=("MSMBuilder is no longer maintained. " - + "MSMBFeaturizer is no longer officially supported."), - remedy="Create a CoordinateFunctionCV based on MSMBuilderFeaturizers.", - remove_version=(2, 0), - deprecated_in=(1, 1, 0) -) - # has_deprecations and deprecate hacks to change docstrings inspired by: # https://stackoverflow.com/a/47441572/4205735 def has_deprecations(cls): diff --git a/openpathsampling/engines/openmm/engine.py b/openpathsampling/engines/openmm/engine.py index 80fe1fb62..4d8319351 100644 --- a/openpathsampling/engines/openmm/engine.py +++ b/openpathsampling/engines/openmm/engine.py @@ -30,18 +30,9 @@ def restore_custom_integrator_interface(integrator): except ImportError: # pragma: no cover pass # if openmmtools doesn't exist, can't restore interface else: - try: - # openmmtools 0.15 or later - from openmmtools.utils import RestorableOpenMMObject \ - as RestorableObject - except ImportError: # pragma: no cover - # DEPRECATED: remove in 2.0 (support for openmmtools < 0.15) - from openpathsampling.deprecations import OPENMMTOOLS_VERSION - OPENMMTOOLS_VERSION.warn() - from openmmtools.integrators import RestorableIntegrator \ - as RestorableObject - - if RestorableObject.is_restorable(integrator): + # openmmtools 0.15 or later + from openmmtools.utils import RestorableOpenMMObject + if RestorableOpenMMObject.is_restorable(integrator): success = RestorableObject.restore_interface(integrator) logger.debug("Restored interface to integrator: " + str(success)) # this return a bool based on success; we could error on fail, diff --git a/openpathsampling/high_level/interface_set.py b/openpathsampling/high_level/interface_set.py index f0c27eebb..ad13fd643 100644 --- a/openpathsampling/high_level/interface_set.py +++ b/openpathsampling/high_level/interface_set.py @@ -216,22 +216,13 @@ def to_dict(self): 'intersect_with': self.intersect_with, 'lambdas': self.lambdas, 'direction': self.direction, - 'volumes': self.volumes} - try: - dct.update({'cv_max': self.cv_max}) - except AttributeError: # pragma: no cover - # reverse compatibility; deprecated in 0.9.5, remove in 2.0 - pass - + 'volumes': self.volumes, + 'cv_max': self.cv_max} return dct def _load_from_dict(self, dct): self.cv = dct['cv'] - try: - self.cv_max = dct['cv_max'] - except KeyError: # pragma: no cover - # reverse compatibility; deprecated in 0.9.4, remove in 2.0 - pass + self.cv_max = dct['cv_max'] self.minvals = dct['minvals'] self.maxvals = dct['maxvals'] self.intersect_with = dct['intersect_with'] diff --git a/openpathsampling/high_level/network.py b/openpathsampling/high_level/network.py index 78f51d8e4..f1f0ea9dd 100644 --- a/openpathsampling/high_level/network.py +++ b/openpathsampling/high_level/network.py @@ -203,15 +203,8 @@ def to_dict(self): 'x_sampling_transitions': self._sampling_transitions, 'special_ensembles': self.special_ensembles } - try: - ret_dict['initial_states'] = self.initial_states - ret_dict['final_states'] = self.final_states - except AttributeError: # pragma: no cover - # DEPRECATED: remove for 2.0 - from openpathsampling.deprecations import \ - SAVE_RELOAD_OLD_TPS_NETWORK - SAVE_RELOAD_OLD_TPS_NETWORK.warn() - pass # backward compatibility + ret_dict['initial_states'] = self.initial_states + ret_dict['final_states'] = self.final_states return ret_dict @property @@ -225,18 +218,9 @@ def from_dict(cls, dct): super(GeneralizedTPSNetwork, network).__init__() network._sampling_transitions = dct['x_sampling_transitions'] network.transitions = dct['transitions'] - try: - network.initial_states = dct['initial_states'] - network.final_states = dct['final_states'] - except KeyError: # pragma: no cover - # DEPRECATED: remove for 2.0 - pass # backward compatibility - try: - network.special_ensembles = dct['special_ensembles'] - except KeyError: # pragma: no cover - # DEPRECATED: remove for 2.0 - network.special_ensembles = {None: {}} - # default behavior for backward compatibility + network.initial_states = dct['initial_states'] + network.final_states = dct['final_states'] + network.special_ensembles = dct['special_ensembles'] return network @classmethod @@ -263,7 +247,10 @@ def from_state_pairs(cls, state_pairs, **kwargs): dict_result = { 'x_sampling_transitions': sampling, - 'transitions': transitions + 'transitions': transitions, + 'initial_states': initial_states, + 'final_states': final_states, + 'special_ensembles': {}, } dict_result.update(kwargs) network = cls.from_dict(dict_result) diff --git a/openpathsampling/pathmover.py b/openpathsampling/pathmover.py index 32c39ff94..4aaff7299 100644 --- a/openpathsampling/pathmover.py +++ b/openpathsampling/pathmover.py @@ -16,9 +16,6 @@ from .ops_logging import initialization_logging from .treelogic import TreeMixin -from openpathsampling.deprecations import deprecate, has_deprecations -from openpathsampling.deprecations import SAMPLE_DETAILS, MOVE_DETAILS - from future.utils import with_metaclass logger = logging.getLogger(__name__) @@ -2630,28 +2627,3 @@ def __str__(self): else: mystr += str(key) + " = " + str(self.__dict__[key]) + '\n' return mystr - - -@has_deprecations -@deprecate(MOVE_DETAILS) -class MoveDetails(Details): - """Details of the move as applied to a given replica - - Specific move types may have add several other attributes for each - MoveDetails object. For example, shooting moves will also include - information about the shooting point selection, etc. - """ - - def __init__(self, **kwargs): - super(MoveDetails, self).__init__(**kwargs) - - -# leave this for potential backwards compatibility -@has_deprecations -@deprecate(SAMPLE_DETAILS) -class SampleDetails(Details): - """Details of a sample - """ - - def __init__(self, **kwargs): - super(SampleDetails, self).__init__(**kwargs) diff --git a/openpathsampling/tests/test_api.py b/openpathsampling/tests/test_api.py index 826257e24..1f1f7f6ff 100644 --- a/openpathsampling/tests/test_api.py +++ b/openpathsampling/tests/test_api.py @@ -6,7 +6,7 @@ # select the file you want to use, or change to the file for your own API # (add more files to ensure that we support 1.0, 1.1, etc.) -API_FILES = ["ops1x0_api.txt"] +API_FILES = [] # we'll establish API 2.0 before release COMBO_ERROR = True @pytest.mark.parametrize('api_file', API_FILES) From ed62e0d4402a4c6404187245db216811bcd57423 Mon Sep 17 00:00:00 2001 From: sroet Date: Fri, 19 Feb 2021 18:52:48 +0100 Subject: [PATCH 11/25] kill off getslice --- openpathsampling/engines/trajectory.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/openpathsampling/engines/trajectory.py b/openpathsampling/engines/trajectory.py index 8380dd549..9f6e66876 100644 --- a/openpathsampling/engines/trajectory.py +++ b/openpathsampling/engines/trajectory.py @@ -169,18 +169,10 @@ def is_snapshot_attr(cls, item): ) raise AttributeError(msg) - # ========================================================================== # LIST INHERITANCE FUNCTIONS # ========================================================================== - def __getslice__(self, *args, **kwargs): - ret = list.__getslice__(self, *args, **kwargs) - if type(ret) is list: - ret = Trajectory(ret) - - return ret - # this is intuitive. hash(Trajectory(traj)) == hash(traj) # but hash(LoaderProxy(..., traj.__uuid__)) != hash(traj) From adf571fb3437244113d3352cbe85e41fe92327c6 Mon Sep 17 00:00:00 2001 From: sroet Date: Fri, 19 Feb 2021 22:08:01 +0100 Subject: [PATCH 12/25] disable python 2.7 tests for dev-2.0 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2d7a80f49..8db2676c2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: #- 3.9 #- 3.8 - 3.7 - - 2.7 + #- 2.7 MINIMAL: [""] include: - CONDA_PY: 3.7 From 938d42a7c89fd389947eff600df7585e82ceedd0 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Sun, 21 Feb 2021 09:58:25 +0100 Subject: [PATCH 13/25] Remove some Py2-specific code --- openpathsampling/analysis/shooting_point_analysis.py | 7 +------ openpathsampling/collectivevariable.py | 6 +----- openpathsampling/deprecations.py | 7 +------ openpathsampling/sample.py | 6 +----- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/openpathsampling/analysis/shooting_point_analysis.py b/openpathsampling/analysis/shooting_point_analysis.py index 2bece39d4..fda46cef1 100644 --- a/openpathsampling/analysis/shooting_point_analysis.py +++ b/openpathsampling/analysis/shooting_point_analysis.py @@ -3,12 +3,7 @@ import numpy as np from openpathsampling.progress import SimpleProgress - -try: - from collections import abc -except ImportError: - import collections as abc - +from collections import abc # based on http://stackoverflow.com/a/3387975 class TransformedDict(abc.MutableMapping): diff --git a/openpathsampling/collectivevariable.py b/openpathsampling/collectivevariable.py index 53174f528..ecffed074 100644 --- a/openpathsampling/collectivevariable.py +++ b/openpathsampling/collectivevariable.py @@ -8,11 +8,7 @@ from openpathsampling.deprecations import (has_deprecations, deprecate, MSMBUILDER) -import sys -if sys.version_info > (3, ): - get_code = lambda func: func.__code__ -else: - get_code = lambda func: func.func_code +get_code = lambda func: func.__code__ # ============================================================================== diff --git a/openpathsampling/deprecations.py b/openpathsampling/deprecations.py index edacc9fcd..37c1cc362 100644 --- a/openpathsampling/deprecations.py +++ b/openpathsampling/deprecations.py @@ -160,12 +160,7 @@ def has_deprecations(cls): """Decorator to ensure that docstrings get updated for wrapped class""" for obj in [cls] + list(vars(cls).values()): if callable(obj) and hasattr(obj, '__new_docstring'): - try: - obj.__doc__ = obj.__new_docstring - except AttributeError: - # probably Python 2; we can't update docstring in Py2 - # see https://github.com/Chilipp/docrep/pull/9 and related - pass + obj.__doc__ = obj.__new_docstring del obj.__new_docstring return cls diff --git a/openpathsampling/sample.py b/openpathsampling/sample.py index 17164f6bf..7dd648a2a 100644 --- a/openpathsampling/sample.py +++ b/openpathsampling/sample.py @@ -9,11 +9,7 @@ from collections import Counter -import sys -if sys.version_info > (3, ): - from collections.abc import Mapping -else: - from collections import Mapping +from collections.abc import Mapping logger = logging.getLogger(__name__) From b3365df71a895bbd8189eb1dcfe7716181f73535 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 22 Feb 2021 13:46:30 +0100 Subject: [PATCH 14/25] Remove basestring from dynamics_engine --- openpathsampling/engines/dynamics_engine.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/openpathsampling/engines/dynamics_engine.py b/openpathsampling/engines/dynamics_engine.py index 748f5e44f..848c5afba 100644 --- a/openpathsampling/engines/dynamics_engine.py +++ b/openpathsampling/engines/dynamics_engine.py @@ -18,9 +18,6 @@ logger = logging.getLogger(__name__) -if sys.version_info > (3, ): - basestring = str - # ============================================================================= # SOURCE CONTROL # ============================================================================= @@ -251,9 +248,6 @@ def _check_options(self, options=None): okay_options[variable] = my_options[variable] elif isinstance(my_options[variable], type(default_value)): okay_options[variable] = my_options[variable] - elif isinstance(my_options[variable], basestring) \ - and isinstance(default_value, basestring): - okay_options[variable] = my_options[variable] elif default_value is None: okay_options[variable] = my_options[variable] else: From bb98043db0f8dc23e50e187295dd5037f4ea7ff7 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 5 Jul 2021 15:27:46 -0400 Subject: [PATCH 15/25] remove MSMBFeaturizerCV (again) --- openpathsampling/collectivevariables/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openpathsampling/collectivevariables/__init__.py b/openpathsampling/collectivevariables/__init__.py index 2171968f0..4add9d1e3 100644 --- a/openpathsampling/collectivevariables/__init__.py +++ b/openpathsampling/collectivevariables/__init__.py @@ -3,7 +3,6 @@ CoordinateGeneratorCV, InVolumeCV, CallableCV, MDTrajFunctionCV, PyEMMAFeaturizerCV, - MSMBFeaturizerCV, ) from .plumed_wrapper import ( PLUMEDCV, PLUMEDInterface From a4deaf5913268da433b189023b8fc7cc81c9f5cf Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Sun, 1 Aug 2021 22:36:28 -0400 Subject: [PATCH 16/25] Add Python 3.8, 3.9 to CI for OPS 2.0 CI for 2.0 was set up before OpenMM was available on > 3.7. --- .github/workflows/test-2.0.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 8543d1d91..7bdafa4a5 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -18,8 +18,8 @@ jobs: matrix: CONDA_PY: - 3.7 - #- 3.8 - #- 3.9 + - 3.8 + - 3.9 MINIMAL: [""] include: - CONDA_PY: 3.7 From 12665a0b2db7068f243e3c151d1df8705941d42b Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Sun, 1 Aug 2021 23:22:13 -0400 Subject: [PATCH 17/25] port in changes from tests.yml --- .github/workflows/test-2.0.yml | 35 ++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 7bdafa4a5..82f4dcf09 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -15,6 +15,13 @@ jobs: runs-on: ubuntu-latest name: "Unit Tests" strategy: + # NOTE: When changing the test matrix: + # * Update the after_n_builds in codecov.yml to match the number of + # builds in the matrix + # * You may need to create another example run for the notebook tests + # (see examples/ipynbtests.sh; examples/prep_example_data.py). This + # is because Python internals (usually bytecode, which is saved in + # CVs) can differ between minor Python versions. matrix: CONDA_PY: - 3.7 @@ -23,9 +30,12 @@ jobs: MINIMAL: [""] include: - CONDA_PY: 3.7 - MINIMAL: "Minimal" + MINIMAL: "minimal" + steps: - uses: actions/checkout@v2 + with: + fetch-depth: 2 - uses: actions/setup-python@v2 - uses: conda-incubator/setup-miniconda@v2 with: @@ -34,6 +44,7 @@ jobs: - name: "Install requirements" env: MINIMAL: ${{ matrix.MINIMAL }} + CONDA_PY: ${{ matrix.CONDA_PY }} run: | if [ -z "$MINIMAL" ] ; then source devtools/conda_install_reqs.sh @@ -41,22 +52,26 @@ jobs: python -m pip install -r devtools/minimal.txt \ -r devtools/minimal_testing.txt fi + python -m pip install autorelease - name: "Install" - run: python -m pip install --no-deps -e . - - name: "Autorelease check" run: | - python -m pip install autorelease - python devtools/autorelease_check.py + python -m pip install --no-deps -e . + python -c "import openpathsampling" - name: "Versions" run: | conda info --envs conda list + - name: "Autorelease check" + run: python devtools/autorelease_check.py - name: "Unit tests" - run: | - python -c "import openpathsampling" - py.test -vv -s --cov=openpathsampling --cov-report xml - - name: "Test experimental features" + env: + PY_COLORS: "1" + run: py.test -vv -s --cov=openpathsampling --cov-report xml + - name: "Tests: Experimental" if: matrix.MINIMAL == '' run: py.test -vv -s openpathsampling/experimental - #- name: "Upload coverage" + #- name: "Report coverage" #run: bash <(curl -s https://codecov.io/bash) + - name: "Notebook tests" + if: matrix.MINIMAL == '' + run: pushd examples/ && ./ipynbtests.sh || exit 1 && popd From 1bbaed4c5e188afa0e70137404f6465b98df4b33 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 2 Aug 2021 18:39:24 -0400 Subject: [PATCH 18/25] try removing Py3.7 from notebooks I think the files used are old enough that they require workarounds that were removed when deprecations were removed. If this fixes, then I'll create new files for the dev-2.0 branch. --- .github/workflows/test-2.0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 82f4dcf09..11d55bf75 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -24,7 +24,7 @@ jobs: # CVs) can differ between minor Python versions. matrix: CONDA_PY: - - 3.7 + #- 3.7 - 3.8 - 3.9 MINIMAL: [""] From 4e36f5f4a8aa404ec19c2f8f274a8e51d688cf44 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 2 Aug 2021 19:10:08 -0400 Subject: [PATCH 19/25] update dropbox links for py37 --- examples/ipynbtests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ipynbtests.sh b/examples/ipynbtests.sh index ac2bf7e9a..5cdbafe8c 100755 --- a/examples/ipynbtests.sh +++ b/examples/ipynbtests.sh @@ -18,8 +18,8 @@ case $PYTHON_VERSION in mistis=$dropbox_base_url/76981cbgxm639m3/toy_mistis_1k_OPS1_py36.nc ;; "3.7") - mstis=$dropbox_base_url/1ulzssv5p4lr61f/toy_mstis_1k_OPS1_py36.nc - mistis=$dropbox_base_url/76981cbgxm639m3/toy_mistis_1k_OPS1_py36.nc + mstis=$dropbox_base_url/s5d76vg5jyf84oa/toy_mstis_1k_OPS1_py37.nc + mistis=$dropbox_base_url/vzyywl3yli3pp8u/toy_mistis_1k_OPS1_py37.nc ;; "3.8") mstis=$dropbox_base_url/8rr0tt25xlm47cs/toy_mstis_1k_OPS1_py38.nc From 56fc9b96b45b9cd2d3db2c06a94a525de5a38930 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 2 Aug 2021 19:11:42 -0400 Subject: [PATCH 20/25] Add 3.7 back to the matrix --- .github/workflows/test-2.0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 11d55bf75..82f4dcf09 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -24,7 +24,7 @@ jobs: # CVs) can differ between minor Python versions. matrix: CONDA_PY: - #- 3.7 + - 3.7 - 3.8 - 3.9 MINIMAL: [""] From e7473cf47c12b2288ba5e977cd80b6efa913c98e Mon Sep 17 00:00:00 2001 From: sroet Date: Wed, 11 Aug 2021 11:53:10 +0200 Subject: [PATCH 21/25] swap ShootingPointAnalysisError to be a ValueError instead of an AssertionError --- openpathsampling/analysis/shooting_point_analysis.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openpathsampling/analysis/shooting_point_analysis.py b/openpathsampling/analysis/shooting_point_analysis.py index 4fb9c9653..5f4addac3 100644 --- a/openpathsampling/analysis/shooting_point_analysis.py +++ b/openpathsampling/analysis/shooting_point_analysis.py @@ -72,8 +72,7 @@ def __init__(self, *args, **kwargs): *args, **kwargs) -class ShootingPointAnalysisError(AssertionError): - # TODO this should inherit from a different Error type in OPS 2.0 +class ShootingPointAnalysisError(ValueError): pass From 2d950119f97da94f3ab1f6fd70e9abe1084c1596 Mon Sep 17 00:00:00 2001 From: sroet Date: Wed, 11 Aug 2021 16:01:40 +0200 Subject: [PATCH 22/25] inherit from Exception instead --- openpathsampling/analysis/shooting_point_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpathsampling/analysis/shooting_point_analysis.py b/openpathsampling/analysis/shooting_point_analysis.py index 5f4addac3..407757cb5 100644 --- a/openpathsampling/analysis/shooting_point_analysis.py +++ b/openpathsampling/analysis/shooting_point_analysis.py @@ -72,7 +72,7 @@ def __init__(self, *args, **kwargs): *args, **kwargs) -class ShootingPointAnalysisError(ValueError): +class ShootingPointAnalysisError(Exception): pass From 88a8c0d0e2989ee1ad8f69754b0f6abfad05387c Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 29 Apr 2024 16:34:24 -0500 Subject: [PATCH 23/25] update the 2.0 CI script --- .github/workflows/test-2.0.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-2.0.yml b/.github/workflows/test-2.0.yml index 82f4dcf09..727c2e50b 100644 --- a/.github/workflows/test-2.0.yml +++ b/.github/workflows/test-2.0.yml @@ -24,12 +24,12 @@ jobs: # CVs) can differ between minor Python versions. matrix: CONDA_PY: - - 3.7 - - 3.8 - - 3.9 + - "3.12" + - "3.11" + - "3.10" MINIMAL: [""] include: - - CONDA_PY: 3.7 + - CONDA_PY: "3.10" MINIMAL: "minimal" steps: @@ -41,6 +41,7 @@ jobs: with: auto-update-conda: true python-version: ${{ matrix.CONDA_PY }} + miniforge-variant: Mambaforge - name: "Install requirements" env: MINIMAL: ${{ matrix.MINIMAL }} @@ -49,21 +50,27 @@ jobs: if [ -z "$MINIMAL" ] ; then source devtools/conda_install_reqs.sh else - python -m pip install -r devtools/minimal.txt \ - -r devtools/minimal_testing.txt + # In this case we're actually double-installing (not just + # installing requirements here). We prefer this to using the + # conda_install_reqs script so we can test deps coming from PyPI + python -m pip install -e .[test] fi python -m pip install autorelease - name: "Install" run: | python -m pip install --no-deps -e . - python -c "import openpathsampling" + - name: "Check installation" + run: | + python -c "import openpathsampling; print(openpathsampling.version.full_version)" - name: "Versions" run: | conda info --envs conda list - name: "Autorelease check" run: python devtools/autorelease_check.py - - name: "Unit tests" + #- name: "DEBUG: enable SSH login" + #uses: mxschmitt/action-tmate@v3 + - name: "Unit Tests" env: PY_COLORS: "1" run: py.test -vv -s --cov=openpathsampling --cov-report xml From 95d3651f85826ecfdb386eda0dfe4bcf13f6df26 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 29 Apr 2024 20:11:22 -0500 Subject: [PATCH 24/25] both MOVE_DETAILS and SAMPLE_DETAIL were removed --- openpathsampling/pathmover.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openpathsampling/pathmover.py b/openpathsampling/pathmover.py index c6e00cf82..a715e724e 100644 --- a/openpathsampling/pathmover.py +++ b/openpathsampling/pathmover.py @@ -17,8 +17,7 @@ from .treelogic import TreeMixin from openpathsampling.deprecations import deprecate, has_deprecations -from openpathsampling.deprecations import (SAMPLE_DETAILS, MOVE_DETAILS, - NEW_SNAPSHOT_KWARG_SELECTOR) +from openpathsampling.deprecations import NEW_SNAPSHOT_KWARG_SELECTOR from future.utils import with_metaclass From bbf0cabc063968841476f06dac1ca8b76e405af4 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Mon, 29 Apr 2024 20:14:30 -0500 Subject: [PATCH 25/25] yeah, we did remove PyEMMA, didn't we --- openpathsampling/collectivevariables/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openpathsampling/collectivevariables/__init__.py b/openpathsampling/collectivevariables/__init__.py index 4add9d1e3..9c2ee1a91 100644 --- a/openpathsampling/collectivevariables/__init__.py +++ b/openpathsampling/collectivevariables/__init__.py @@ -2,7 +2,6 @@ CollectiveVariable, FunctionCV, CoordinateFunctionCV, GeneratorCV, CoordinateGeneratorCV, InVolumeCV, CallableCV, MDTrajFunctionCV, - PyEMMAFeaturizerCV, ) from .plumed_wrapper import ( PLUMEDCV, PLUMEDInterface