From 3fbb0801667840042c05cb2e1fbfe36c48b57beb Mon Sep 17 00:00:00 2001 From: Thomas Heavey Date: Tue, 30 Jan 2018 16:52:27 -0500 Subject: [PATCH 1/7] ParaTemp-#4 Make travis-ci use locally installed version Update some dates; add check-convergence script to setup.py; add appropriate line break for long string --- paratemp/coordinate_analysis.py | 4 ++-- setup.py | 6 ++++-- tests/test_CoordinateAnalysis.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/paratemp/coordinate_analysis.py b/paratemp/coordinate_analysis.py index 052f794..875d511 100644 --- a/paratemp/coordinate_analysis.py +++ b/paratemp/coordinate_analysis.py @@ -2,10 +2,10 @@ ######################################################################## # # -# This script was written by Thomas Heavey in 2017. # +# This script was written by Thomas Heavey in 2018. # # theavey@bu.edu thomasjheavey@gmail.com # # # -# Copyright 2017 Thomas J. Heavey IV # +# Copyright 2017, 2018 Thomas J. Heavey IV # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # diff --git a/setup.py b/setup.py index e5ae898..a621a43 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from distutils.core import setup +from setuptools import setup import versioneer setup( @@ -6,9 +6,11 @@ version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), packages=['paratemp'], + scripts=['check-convergence.py'], url='https://github.com/theavey/ParaTemp', license='Apache License 2.0', author='Thomas Heavey', author_email='thomasjheavey@gmail.com', - description='Scripts for molecular dynamics analysis and parallel tempering in GROMACS' + description='Scripts for molecular dynamics analysis and parallel ' + 'tempering in GROMACS' ) diff --git a/tests/test_CoordinateAnalysis.py b/tests/test_CoordinateAnalysis.py index 2e4e4e0..8a017f5 100644 --- a/tests/test_CoordinateAnalysis.py +++ b/tests/test_CoordinateAnalysis.py @@ -2,10 +2,10 @@ ######################################################################## # # -# This script was written by Thomas Heavey in 2017. # +# This script was written by Thomas Heavey in 2018. # # theavey@bu.edu thomasjheavey@gmail.com # # # -# Copyright 2017 Thomas J. Heavey IV # +# Copyright 2017-18 Thomas J. Heavey IV # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # From 360fcbc618cce74378060ae64eb72d2602310baf Mon Sep 17 00:00:00 2001 From: Thomas Heavey Date: Tue, 30 Jan 2018 17:36:11 -0500 Subject: [PATCH 2/7] #4 Make travis-ci use locally installed version Test on both Python 2.7 and 3.6; install paratemp locally (though the tests will still use the local, because of the relative references) --- .travis.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0508f5..6388ddd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,13 @@ language: python -# command to install dependencies +matrix: + - python: "2.7" + - python: "3.6" + +# command to install dependencies and package install: - pip install -r requirements.txt + - python setup.py install # command to run tests script: - - pytest # or py.test for Python versions 3.5 and below + - py.test # or py.test for Python versions 3.5 and below From bf7dcf8ff7c1edad4122693840586f09cae82dd8 Mon Sep 17 00:00:00 2001 From: Thomas Heavey Date: Tue, 30 Jan 2018 17:43:47 -0500 Subject: [PATCH 3/7] #4 Make travis-ci use locally installed version switch back to distutils.core.setup because of versioneer? --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a621a43..8dfb47a 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import setup +from distutils.core import setup import versioneer setup( From 767d6792135174f5a29181695b7fde31417d1c41 Mon Sep 17 00:00:00 2001 From: Thomas Heavey Date: Tue, 30 Jan 2018 17:56:33 -0500 Subject: [PATCH 4/7] #4 Make travis-ci use locally installed version Using setuptools again; setting tag_prefix for versioneer --- setup.cfg | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index af1efff..80e2755 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,3 +2,4 @@ VCS = git style = pep440 versionfile_source = paratemp/_version.py +tag_prefix = paratemp- diff --git a/setup.py b/setup.py index 8dfb47a..a621a43 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from distutils.core import setup +from setuptools import setup import versioneer setup( From ab98d584e77f2b58b075fa88b8ad77b52203d3c2 Mon Sep 17 00:00:00 2001 From: Thomas Heavey Date: Tue, 30 Jan 2018 18:05:21 -0500 Subject: [PATCH 5/7] #4 Make travis-ci use locally installed version Trying to get travis to use multiple versions of python --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6388ddd..7369baa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: python -matrix: - - python: "2.7" - - python: "3.6" +python: + - "2.7" + - "3.6" # command to install dependencies and package install: From d49c7b6b46491a74b4e762cd310ff4577c9ced4c Mon Sep 17 00:00:00 2001 From: Thomas Heavey Date: Tue, 30 Jan 2018 18:39:43 -0500 Subject: [PATCH 6/7] #4 Make travis-ci use locally installed version Test locally installed version --- tests/test_CoordinateAnalysis.py | 16 ++++++++-------- tests/test_geometries.py | 16 ++++++++-------- tests/test_sim_setup.py | 16 ++++++++-------- tests/test_tools.py | 6 +++--- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/test_CoordinateAnalysis.py b/tests/test_CoordinateAnalysis.py index 8a017f5..2ac179e 100644 --- a/tests/test_CoordinateAnalysis.py +++ b/tests/test_CoordinateAnalysis.py @@ -39,7 +39,7 @@ def test_matplotlib_testing_backend(): def test_running_mean(): - from ..paratemp.coordinate_analysis import _running_mean + from paratemp.coordinate_analysis import _running_mean tl = [0, 2, 4] assert (_running_mean(tl) == [1, 3]).all() @@ -48,7 +48,7 @@ class TestXTCUniverse(object): @pytest.fixture def univ(self): - from ..paratemp import coordinate_analysis as ca + from paratemp import coordinate_analysis as ca _univ = ca.Universe('tests/test-data/spc2.gro', 'tests/test-data/t-spc2-traj.xtc', temp=205.) @@ -61,7 +61,7 @@ def univ_w_a(self, univ): @pytest.fixture def univ_pbc(self): - from ..paratemp import coordinate_analysis as ca + from paratemp import coordinate_analysis as ca _univ = ca.Universe('tests/test-data/spc2.gro', 'tests/test-data/spc2-traj-pbc.xtc', temp=205.) @@ -117,7 +117,7 @@ def test_calculate_distances_no_recalc(self, univ_w_a, capsys): def test_calculate_distances_yes_recalc(self, univ_w_a): """ - :type univ_w_a: ParaTemp.CoordinateAnalysis.Universe + :type univ_w_a: paratemp.coordinate_analysis.Universe """ univ_w_a.calculate_distances(a='5 5', recalculate=True) assert (np.array([0., 0.]) == univ_w_a.data['a']).all() @@ -129,13 +129,13 @@ def test_distance_pbc(self, univ_pbc, ref_a_pbc_dists): def test_calc_fes_1d(self, univ_w_a, ref_delta_g, ref_bins, ref_delta_g_20, ref_bins_20): """ - :type univ_w_a: ParaTemp.CoordinateAnalysis.Universe + :type univ_w_a: paratemp.coordinate_analysis.Universe :type ref_delta_g: np.ndarray :type ref_bins: np.ndarray :type ref_delta_g_20: np.ndarray :type ref_bins_20: np.ndarray """ - from ..paratemp.coordinate_analysis import _calc_fes_1d + from paratemp.coordinate_analysis import _calc_fes_1d delta_g_data, bins_data = _calc_fes_1d(univ_w_a.data['a'], temp=205., bins=None) assert (delta_g_data == ref_delta_g).all() @@ -147,7 +147,7 @@ def test_calc_fes_1d(self, univ_w_a, ref_delta_g, ref_bins, ref_delta_g_20, def test_fes_1d_data_str(self, univ_w_a, ref_delta_g, ref_bins): """ - :type univ_w_a: ParaTemp.CoordinateAnalysis.Universe + :type univ_w_a: paratemp.coordinate_analysiss.Universe :type ref_delta_g: np.ndarray :type ref_bins: np.ndarray """ @@ -158,7 +158,7 @@ def test_fes_1d_data_str(self, univ_w_a, ref_delta_g, ref_bins): def test_fes_1d_data_data(self, univ_w_a, ref_delta_g, ref_bins): """ - :type univ_w_a: ParaTemp.CoordinateAnalysis.Universe + :type univ_w_a: paratemp.coordinate_analysis.Universe :type ref_delta_g: np.ndarray :type ref_bins: np.ndarray """ diff --git a/tests/test_geometries.py b/tests/test_geometries.py index f3a5f19..cfa5aa7 100644 --- a/tests/test_geometries.py +++ b/tests/test_geometries.py @@ -2,10 +2,10 @@ ######################################################################## # # -# This script was written by Thomas Heavey in 2017. # +# This script was written by Thomas Heavey in 2018. # # theavey@bu.edu thomasjheavey@gmail.com # # # -# Copyright 2017 Thomas J. Heavey IV # +# Copyright 2017-18 Thomas J. Heavey IV # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -32,7 +32,7 @@ class TestXYZ(object): @pytest.fixture def xyz(self): - from ..paratemp.geometries import XYZ + from paratemp.geometries import XYZ return XYZ('tests/test-data/stil-3htmf.xyz') def test_n_atoms(self, xyz): @@ -51,27 +51,27 @@ def pi(self): @pytest.fixture def x_axis_int_list(self): - from ..paratemp.geometries import Vector + from paratemp.geometries import Vector return Vector([1, 0, 0]) @pytest.fixture def x_axis_float_list(self): - from ..paratemp.geometries import Vector + from paratemp.geometries import Vector return Vector([1., 0., 0.]) @pytest.fixture def x_axis_int(self): - from ..paratemp.geometries import Vector + from paratemp.geometries import Vector return Vector(1, 0, 0) @pytest.fixture def y_axis(self): - from ..paratemp.geometries import Vector + from paratemp.geometries import Vector return Vector(0, 1, 0) @pytest.fixture def z_axis(self): - from ..paratemp.geometries import Vector + from paratemp.geometries import Vector return Vector(0, 0, 1) def test_input_int_float(self, x_axis_int_list, x_axis_float_list): diff --git a/tests/test_sim_setup.py b/tests/test_sim_setup.py index 0a698a0..99749cd 100644 --- a/tests/test_sim_setup.py +++ b/tests/test_sim_setup.py @@ -2,10 +2,10 @@ ######################################################################## # # -# This script was written by Thomas Heavey in 2017. # +# This script was written by Thomas Heavey in 2018. # # theavey@bu.edu thomasjheavey@gmail.com # # # -# Copyright 2017 Thomas J. Heavey IV # +# Copyright 2017-18 Thomas J. Heavey IV # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -30,7 +30,7 @@ def test_job_info_from_qsub(): - from ..paratemp.sim_setup import _job_info_from_qsub + from paratemp.sim_setup import _job_info_from_qsub job_info = _job_info_from_qsub('Your job 2306551 ("PT-NTD-CG") ' 'has been submitted') assert job_info == ('2306551', 'PT-NTD-CG', '2306551 ("PT-NTD-CG")') @@ -62,14 +62,14 @@ def rd1030(self): return {10: 30} def test_update_num(self, match_10, rd1030): - from ..paratemp.sim_setup import _update_num + from paratemp.sim_setup import _update_num assert '=30' == _update_num(match_10, shift=10, cat_repl_dict=rd1030) assert '=1' == _update_num(match_10, shift=9, cat_repl_dict=dict()) assert '=1' == _update_num(match_10, shift=9, cat_repl_dict=rd1030) def test_update_num_raises(self, match_10, match_text, match_float, match_bad_few, match_bad_many): - from ..paratemp.sim_setup import _update_num + from paratemp.sim_setup import _update_num with pytest.raises(KeyError): _update_num(match_10, shift=10, cat_repl_dict=dict()) with pytest.raises(ValueError, @@ -102,7 +102,7 @@ def folder_dc(n_top_dc): class TestGetSolvCountTop(object): def test_get_solv_count_top(self, n_top_dc, folder_dc): - from ..paratemp.sim_setup import get_solv_count_top + from paratemp.sim_setup import get_solv_count_top assert get_solv_count_top(n_top_dc) == 361 assert get_solv_count_top(folder=folder_dc) == 361 @@ -110,11 +110,11 @@ def test_get_solv_count_top(self, n_top_dc, folder_dc): class TestSetSolvCountTop(object): def test_set_solv_count_top_n(self, n_top_dc): - from ..paratemp.sim_setup import set_solv_count_top, get_solv_count_top + from paratemp.sim_setup import set_solv_count_top, get_solv_count_top set_solv_count_top(n_top_dc, s_count=100) assert get_solv_count_top(n_top_dc) == 100 def test_set_solv_count_top_folder(self, folder_dc, n_top_dc): - from ..paratemp.sim_setup import set_solv_count_top, get_solv_count_top + from paratemp.sim_setup import set_solv_count_top, get_solv_count_top set_solv_count_top(folder=folder_dc, s_count=50) assert get_solv_count_top(n_top_dc) == 50 diff --git a/tests/test_tools.py b/tests/test_tools.py index 70b020a..733c4f5 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -2,10 +2,10 @@ ######################################################################## # # -# This script was written by Thomas Heavey in 2017. # +# This script was written by Thomas Heavey in 2018. # # theavey@bu.edu thomasjheavey@gmail.com # # # -# Copyright 2017 Thomas J. Heavey IV # +# Copyright 2017-18 Thomas J. Heavey IV # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -34,5 +34,5 @@ def ref_temps(): def test_get_temps(ref_temps): - from ..paratemp import get_temperatures + from paratemp import get_temperatures assert (get_temperatures('tests/test-data/temperatures.dat') == ref_temps).all() From b056424be57a343d1ad0eb7e45d5fc6ec7792763 Mon Sep 17 00:00:00 2001 From: Thomas Heavey Date: Tue, 30 Jan 2018 18:46:09 -0500 Subject: [PATCH 7/7] #4 Make travis-ci use locally installed version __init__ at top level no longer needed (was needed for testing with relative imports) --- __init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 __init__.py diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000