From 5341826ebe26983f160db79efcdbbb5fef0a5dee Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Thu, 27 Apr 2023 16:48:07 -0400 Subject: [PATCH 01/13] MAINT: update rc install --- .github/workflows/pysat_rc.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pysat_rc.yml b/.github/workflows/pysat_rc.yml index ce0005e7..57113c3d 100644 --- a/.github/workflows/pysat_rc.yml +++ b/.github/workflows/pysat_rc.yml @@ -1,4 +1,4 @@ -# This workflow will install Python dependencies (including the latest RC +# This workflow will install Python dependencies (including the latest RC # for pysat packages) and run tests for supported operating systems. # For more information see: # https://help.github.com/actions/language-and-framework-guides/ @@ -27,7 +27,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install RC package - run: pip install --no-deps -i https://test.pypi.org/simple/ ${{ matrix.rc-package }} + run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ${{ matrix.rc-package }} - name: Install standard dependencies run: | From 3e128901ed8345e4b6ccce4d82f4dc71118b6972 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Thu, 27 Apr 2023 16:49:37 -0400 Subject: [PATCH 02/13] TST: add rc test --- .github/workflows/pip_rc_install.yml | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/pip_rc_install.yml diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml new file mode 100644 index 00000000..700b3758 --- /dev/null +++ b/.github/workflows/pip_rc_install.yml @@ -0,0 +1,33 @@ +# This workflow will install Python dependencies and the latest RC of pysatNASA from test pypi. +# This test should be manually run before a pysatModels RC is officially approved and versioned. +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Test install of latest RC from pip + +on: [workflow_dispatch] + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.10"] # Keep this version at the highest supported Python version + + name: Python ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install standard dependencies + run: pip install -r requirements.txt + + - name: Install pysatModels RC + run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pysatModels + + - name: Check that install imports correctly + run: python -c "import pysatModels" From 6c0e85c76c2cc79e9037c264b793b7bcbd3d0300 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Thu, 27 Apr 2023 16:50:54 -0400 Subject: [PATCH 03/13] DOC: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 417b7883..edce123b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). * Switched pydineof_dineof load code to use newer `pysat.utils.io.load_netcdf` * Updated NEP29 and GitHub actions versions * Added manual test for pysat and pysatNASA Release Candidates + * Added manual test for pysatModels RC pip install * Documentation * Added badges and instructions for PyPi and Zenodo From 7ff0b7e108135cfa6ae25ce20b811b42a48979f3 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Thu, 27 Apr 2023 16:51:28 -0400 Subject: [PATCH 04/13] TST: set RC workflows to push --- .github/workflows/pip_rc_install.yml | 2 +- .github/workflows/pysat_rc.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml index 700b3758..c1f58850 100644 --- a/.github/workflows/pip_rc_install.yml +++ b/.github/workflows/pip_rc_install.yml @@ -4,7 +4,7 @@ name: Test install of latest RC from pip -on: [workflow_dispatch] +on: [push] jobs: build: diff --git a/.github/workflows/pysat_rc.yml b/.github/workflows/pysat_rc.yml index 57113c3d..19054a67 100644 --- a/.github/workflows/pysat_rc.yml +++ b/.github/workflows/pysat_rc.yml @@ -6,7 +6,7 @@ name: Test with pysat ecosystem RCs -on: [workflow_dispatch] +on: [push] jobs: build: From ef824b9b429251a4e35676887a1d1e94b5aca1f2 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Mon, 1 May 2023 11:00:37 -0400 Subject: [PATCH 05/13] BUG: set up pysat --- .github/workflows/pip_rc_install.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml index c1f58850..492386b4 100644 --- a/.github/workflows/pip_rc_install.yml +++ b/.github/workflows/pip_rc_install.yml @@ -29,5 +29,10 @@ jobs: - name: Install pysatModels RC run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pysatModels + - name: Set up pysat + run: | + mkdir pysatData + python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'" + - name: Check that install imports correctly run: python -c "import pysatModels" From ce10477e6ea00e4843e3dcf04c2cf88a19aa50a5 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Mon, 1 May 2023 11:00:46 -0400 Subject: [PATCH 06/13] MAINT: upper limit hacking --- test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_requirements.txt b/test_requirements.txt index b8a41858..b120f7ef 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,7 +1,7 @@ coveralls flake8 flake8-docstrings -hacking>=1.0 +hacking>=1.0,<6.0 m2r2 numpydoc pytest-cov From 64e888ce022be7fcc9492417b8626b9878bca56e Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Mon, 1 May 2023 14:35:21 -0400 Subject: [PATCH 07/13] MAINT: update deprecated syntax --- pysatModels/tests/test_models.py | 2 +- pysatModels/tests/test_utils_compare.py | 4 ++-- pysatModels/tests/test_utils_match.py | 9 +++++---- pysatModels/utils/match.py | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pysatModels/tests/test_models.py b/pysatModels/tests/test_models.py index 77d2895f..72411d63 100644 --- a/pysatModels/tests/test_models.py +++ b/pysatModels/tests/test_models.py @@ -235,7 +235,7 @@ def test_multidayload(self): assert meta_two_days == meta_one_days # Confirm time index information - assert data_two_days.indexes['time'].is_monotonic + assert data_two_days.indexes['time'].is_monotonic_increasing assert data_two_days.indexes['time'][0] >= test_date assert data_two_days.indexes['time'][0] < date assert data_two_days.indexes['time'][-1] > date diff --git a/pysatModels/tests/test_utils_compare.py b/pysatModels/tests/test_utils_compare.py index 56bcbe03..3076119d 100644 --- a/pysatModels/tests/test_utils_compare.py +++ b/pysatModels/tests/test_utils_compare.py @@ -11,7 +11,7 @@ class TestUtilsCompare(object): """Unit tests for utils.compare.""" - def setup(self): + def setup_method(self): """Set up the unit test environment for each method.""" coords = {"lat": np.arange(-90, 90, 10), "alt": np.arange(200, 800, 10)} @@ -29,7 +29,7 @@ def setup(self): self.out_units = dict() return - def teardown(self): + def teardown_method(self): """Clean up the unit test environment after each method.""" del self.dat_key, self.mod_key, self.units, self.pairs, self.input_args diff --git a/pysatModels/tests/test_utils_match.py b/pysatModels/tests/test_utils_match.py index cb667c44..576fa875 100644 --- a/pysatModels/tests/test_utils_match.py +++ b/pysatModels/tests/test_utils_match.py @@ -13,17 +13,18 @@ class TestUtilsMatchCollectInstModPairs(object): """Unit tests for utils.match.collect_inst_model_pairs.""" - def setup(self): + def setup_method(self): """Set up the unit test environment for each method.""" - self.inst = pysat.Instrument(platform='pysat', name='testing') + self.inst = pysat.Instrument(platform='pysat', name='testing', + use_header=True) self.stime = pysat.instruments.pysat_testing._test_dates[''][''] self.inst.load(date=self.stime) self.input_args = [self.stime, self.stime + dt.timedelta(days=1), dt.timedelta(days=1), self.inst] self.ref_col = 'dummy1' self.model = pysat.Instrument(platform='pysat', name='testmodel', - tag='', num_samples=10) + tag='', num_samples=10, use_header=True) self.required_kwargs = {"model_load_kwargs": {"model_inst": self.model}, "inst_clean_rout": lambda x: True, @@ -37,7 +38,7 @@ def setup(self): self.out = None return - def teardown(self): + def teardown_method(self): """Clean up the unit test environment after each method.""" del self.input_args, self.required_kwargs, self.inst, self.model diff --git a/pysatModels/utils/match.py b/pysatModels/utils/match.py index efd33da1..2c0534c9 100644 --- a/pysatModels/utils/match.py +++ b/pysatModels/utils/match.py @@ -163,7 +163,7 @@ def collect_inst_model_pairs(start, stop, tinc, inst, inst_download_kwargs=None, if not skip_download and (stop - start).days != len(inst.files[start:stop]): missing_times = [tt for tt in pds.date_range(start, stop, freq='1D', - closed='left') + inclusive='left') if tt not in inst.files[start:stop].index] for tt in missing_times: inst.download(start=tt, stop=tt + pds.DateOffset(days=1), From 037a92580547b88fc8b103934c147a8f04ee2b55 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Wed, 3 May 2023 14:21:16 -0400 Subject: [PATCH 08/13] Apply suggestions from code review Co-authored-by: Angeline Burrell --- .github/workflows/pip_rc_install.yml | 2 +- .github/workflows/pysat_rc.yml | 2 +- CHANGELOG.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml index 492386b4..67c26b38 100644 --- a/.github/workflows/pip_rc_install.yml +++ b/.github/workflows/pip_rc_install.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.10"] # Keep this version at the highest supported Python version + python-version: ["3.8", "3.9", "3.10"] # Keep this version at the highest supported Python version name: Python ${{ matrix.python-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/pysat_rc.yml b/.github/workflows/pysat_rc.yml index 19054a67..57113c3d 100644 --- a/.github/workflows/pysat_rc.yml +++ b/.github/workflows/pysat_rc.yml @@ -6,7 +6,7 @@ name: Test with pysat ecosystem RCs -on: [push] +on: [workflow_dispatch] jobs: build: diff --git a/CHANGELOG.md b/CHANGELOG.md index edce123b..8563e200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). * Updated NEP29 and GitHub actions versions * Added manual test for pysat and pysatNASA Release Candidates * Added manual test for pysatModels RC pip install + * Updated tests to new pysat and pytest standards * Documentation * Added badges and instructions for PyPi and Zenodo From c419db1516d42f7f4b60b10a0ddc0e2d4d451d4d Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Wed, 3 May 2023 14:29:57 -0400 Subject: [PATCH 09/13] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 540b4e62..2fc4e0e1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ numpy packaging -pandas +pandas >= 1.4.0 pyForecastTools pysat >= 3.0.4 pysatNASA From 03e70d827b2335a3a74256dcfc585e3348619161 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Wed, 3 May 2023 14:30:26 -0400 Subject: [PATCH 10/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73fa4f60..d57ee54e 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ the Space Physics community. This module officially supports Python 3.6+. | Common modules | Community modules | | ------------------ | ----------------- | | numpy | pyForecastTools | -| pandas | pysat >= 3.0.4 | +| pandas >= 1.4.0 | pysat >= 3.0.4 | | requests | pysatNASA | | scipy | | | xarray | | From 8c0c2adc7c2e685dfa846996a4110cf9c3c1594e Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Thu, 18 May 2023 10:31:26 +0900 Subject: [PATCH 11/13] Update test_requirements.txt --- test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_requirements.txt b/test_requirements.txt index b120f7ef..3774865f 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -6,5 +6,5 @@ m2r2 numpydoc pytest-cov pytest-ordering -sphinx +sphinx<7.0 sphinx_rtd_theme From 90502dcfb13b474fd50e21fcf9b55e856b8adbd4 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Thu, 18 May 2023 10:31:40 +0900 Subject: [PATCH 12/13] Update .github/workflows/pip_rc_install.yml --- .github/workflows/pip_rc_install.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml index 67c26b38..db019679 100644 --- a/.github/workflows/pip_rc_install.yml +++ b/.github/workflows/pip_rc_install.yml @@ -35,4 +35,6 @@ jobs: python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'" - name: Check that install imports correctly - run: python -c "import pysatModels" + run: | + cd .. + python -c "import pysatModels; print(pysatModels.__version__)" From 919c71e156c18a3822a60417e92d8034b2f44618 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Fri, 19 May 2023 10:48:56 +0900 Subject: [PATCH 13/13] Update .github/workflows/pip_rc_install.yml --- .github/workflows/pip_rc_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml index db019679..34f71e12 100644 --- a/.github/workflows/pip_rc_install.yml +++ b/.github/workflows/pip_rc_install.yml @@ -4,7 +4,7 @@ name: Test install of latest RC from pip -on: [push] +on: [workflow_dispatch] jobs: build: