Repository: jbusecke/xMIP (language: python)

Issue:
Update CI
Modernizing CI actions similar to [xgcm](https://github.com/xgcm/xgcm) and xmovie


Discussion / hints:
Ill take care of the cloud test failure in #127 and merge this as is.

Fix patch:
diff --git a/.github/workflows/pythonpublish.yaml b/.github/workflows/pythonpublish.yaml
index b3b4cb05..55b86fab 100644
--- a/.github/workflows/pythonpublish.yaml
+++ b/.github/workflows/pythonpublish.yaml
@@ -3,9 +3,9 @@ on:
   release:
     types:
       - published
-#   push:
-#     tags:
-#       - 'v*'
+  push:
+    tags:
+      - 'v*'
 
 jobs:
   build-artifacts:
@@ -19,11 +19,13 @@ jobs:
         name: Install Python
         with:
           python-version: 3.8
-
       - name: Install dependencies
         run: |
           python -m pip install --upgrade pip
-          python -m pip install setuptools setuptools-scm wheel twine check-manifest
+          python -m pip install setuptools setuptools-scm[toml] wheel twine
+      - name: Check python version
+        run: |
+          python --version
       - name: Check current package version
         run: |
           python setup.py --version
@@ -31,7 +33,7 @@ jobs:
         run: |
           git clean -xdf
           git restore -SW .
-          python -m build --sdist --wheel .
+          python setup.py sdist bdist_wheel
       - name: Check built artifacts
         run: |
           python -m twine check dist/*
@@ -70,13 +72,21 @@ jobs:
           password: ${{ secrets.TESTPYPI_TOKEN }}
           repository_url: https://test.pypi.org/legacy/
           verbose: true
-
+      # - name: Setup upterm session
+      #   uses: lhotari/action-upterm@v1
       - name: Check uploaded package
         run: |
-          sleep 3
+          sleep 10
           python -m pip install --upgrade pip
-          python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade cmip6_preprocessing
-          python setup.py --version
+          pip cache purge
+          # This is kind of stupid, but the only way I got this to work with the latest versions on testpypi
+          # If I used: python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade cmip6_preprocessing
+          # It would grab an older cmip6_pp version and with `--index-url=...` I cant get the proper dependencies from pypi
+          # So I am installing the dependencies manually from pypi and the newest version from testpypi...not sure if this
+          # defeats the purpose, but I am frankly fed up with this shit!
+          python -m pip install xgcm xarray numpy pandas cftime
+          python -m pip install --index-url https://test.pypi.org/simple --upgrade cmip6_preprocessing
+          python -c "import cmip6_preprocessing;print(cmip6_preprocessing.__version__)"
   upload-to-pypi:
     needs: test-built-dist
     if: github.event_name == 'release'
diff --git a/docs/conf.py b/docs/conf.py
index 5dbd0803..fd2f70b6 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -24,6 +24,13 @@
 
 import cmip6_preprocessing  # isort:skip
 
+# -- Project information -----------------------------------------------------
+
+project = "cmip6_preprocessing"
+copyright = "2021, cmip6_preprocessing maintainers"
+author = "cmip6_preprocessing maintainers"
+
+# -- Version -----------------------------------------------------------------
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
@@ -34,13 +41,6 @@
 release = cmip6_preprocessing.__version__
 
 
-# -- Project information -----------------------------------------------------
-
-project = "cmip6_preprocessing"
-copyright = "2021, cmip6_preprocessing maintainers"
-author = "cmip6_preprocessing maintainers"
-
-
 # -- General configuration ---------------------------------------------------
 
 # Add any Sphinx extension module names here, as strings. They can be
diff --git a/pyproject.toml b/pyproject.toml
index 5e19d0be..d7296adf 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,5 @@
 [build-system]
-requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
+requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
 build-backend = "setuptools.build_meta"
 
 [tool.setuptools_scm]
diff --git a/setup.cfg b/setup.cfg
index 8d1c8fa1..716e5545 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -55,14 +55,10 @@ author_email = jbusecke@princeton.edu
 [options]
 install_requires =
     numpy
-    xarray
     pandas
-    regionmask
+    xarray
     xgcm
     cftime
-    cartopy
-    proj
-    geos
 setup_requires=
     setuptools
     setuptools-scm
diff --git a/setup.py b/setup.py
index 95c6d1ec..56df5be1 100644
--- a/setup.py
+++ b/setup.py
@@ -6,5 +6,6 @@
         "write_to": "cmip6_preprocessing/_version.py",
         "write_to_template": '__version__ = "{version}"',
         "tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$",
-    }
+    },
+    setup_requires=["setuptools>=45", "setuptools_scm[toml]>=6.0"],
 )


Test patch:
diff --git a/ci/environment-cloud-test.yml b/ci/environment-cloud-test.yml
index 733676db..6b93fcba 100644
--- a/ci/environment-cloud-test.yml
+++ b/ci/environment-cloud-test.yml
@@ -2,12 +2,8 @@ name: test_env_cmip6_preprocessing
 channels:
   - conda-forge
 dependencies:
-
-  - python=3.8
   - xarray
   - xgcm
-  - cftime
-  - regionmask
   # Dependencies for the pangeo cloud data
   - intake-esm
   - gcsfs