Skip to content

Commit

Permalink
ci: use micromamba for builds (#83)
Browse files Browse the repository at this point in the history
* ci: use micromamba for builds

docs: use mambaforge for builds

* ci: bump versions
  • Loading branch information
tsutterley authored Sep 18, 2023
1 parent 416d76d commit 74bef99
Show file tree
Hide file tree
Showing 35 changed files with 20 additions and 158 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/auto-update-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
python-version: [3.11]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
Expand All @@ -24,17 +24,22 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
- name: Set up conda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- name: Set up mamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: icesat2_toolkit
micromamba-version: 'latest'
environment-file: environment.yml
- name: Create conda Test Environment
run: |
conda install flake8 pytest pytest-cov cython
init-shell: bash
environment-name: icesat2_toolkit
cache-environment: true
post-cleanup: 'all'
create-args: >-
python=${{ matrix.python-version }}
flake8
pytest
pytest-cov
cython
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -57,7 +62,7 @@ jobs:
fi
- name: Create pull request
if: steps.changes.outputs.DETECTED == 'true'
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v5
with:
assignees: ${{ github.actor }}
title: "data: automatic time updates"
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up mamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
Expand Down
5 changes: 0 additions & 5 deletions icesat2_toolkit/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,15 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
try:
import pandas
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("pandas not available", ImportWarning)
try:
import zarr
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("zarr not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

class convert():
np.seterr(invalid='ignore')
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
try:
import sklearn.neighbors
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("scikit-learn not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: compress complete list of valid indices into a set of ranges
def compress_list(i,n):
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/io/ATL03.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: read ICESat-2 ATL03 HDF5 data files
def read_granule(FILENAME, ATTRIBUTES=False, **kwargs):
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/io/ATL06.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: read ICESat-2 ATL06 HDF5 data files
def read_granule(FILENAME, ATTRIBUTES=False, HISTOGRAM=False,
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/io/ATL07.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: read ICESat-2 ATL07 HDF5 data files
def read_granule(FILENAME, ATTRIBUTES=False, **kwargs):
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/io/ATL10.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: read ICESat-2 ATL10 HDF5 data files
def read_granule(FILENAME, ATTRIBUTES=False, **kwargs):
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/io/ATL11.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: read ICESat-2 ATL11 HDF5 data files
def read_granule(FILENAME, GROUPS=['cycle_stats'], ATTRIBUTES=False,
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/io/ATL12.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: read ICESat-2 ATL12 HDF5 data files
def read_granule(FILENAME, ATTRIBUTES=False, **kwargs):
Expand Down
5 changes: 0 additions & 5 deletions icesat2_toolkit/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,15 @@
try:
import osgeo.gdal, osgeo.osr, osgeo.gdalconst
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("GDAL not available", ImportWarning)
try:
import h5py
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
try:
import netCDF4
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("netCDF4 not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

def case_insensitive_filename(filename: str | pathlib.Path):
"""
Expand Down
3 changes: 0 additions & 3 deletions icesat2_toolkit/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
import matplotlib.cm as cm
import matplotlib.colors as colors
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("matplotlib not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

def from_cpt(filename, use_extremes=True, **kwargs):
"""
Expand Down
4 changes: 0 additions & 4 deletions icesat2_toolkit/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,11 @@
try:
import boto3
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("boto3 not available", ImportWarning)
try:
import s3fs
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("s3fs not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: get absolute path within a package from a relative path
def get_data_path(relpath: list | str | pathlib.Path):
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: "ubuntu-22.04"
tools:
python: "miniconda3-4.7"
python: "mambaforge-22.9"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
7 changes: 0 additions & 7 deletions scripts/MPI_DEM_ICESat2_ATL03.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,31 +115,24 @@
try:
import fiona
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("fiona not available")
warnings.warn("Some functions will throw an exception if called")
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
try:
from mpi4py import MPI
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("mpi4py not available", ImportWarning)
try:
import osgeo.gdal
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("GDAL not available", ImportWarning)
try:
from shapely.geometry import MultiPoint, Polygon
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("shapely not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# digital elevation models
elevation_dir = {}
Expand Down
7 changes: 0 additions & 7 deletions scripts/MPI_DEM_ICESat2_ATL06.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,31 +115,24 @@
try:
import fiona
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("fiona not available")
warnings.warn("Some functions will throw an exception if called")
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
try:
from mpi4py import MPI
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("mpi4py not available", ImportWarning)
try:
import osgeo.gdal
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("GDAL not available", ImportWarning)
try:
from shapely.geometry import MultiPoint, Polygon
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("shapely not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# digital elevation models
elevation_dir = {}
Expand Down
7 changes: 0 additions & 7 deletions scripts/MPI_DEM_ICESat2_ATL11.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,24 @@
try:
import fiona
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("fiona not available")
warnings.warn("Some functions will throw an exception if called")
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
try:
from mpi4py import MPI
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("mpi4py not available", ImportWarning)
try:
import osgeo.gdal
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("GDAL not available", ImportWarning)
try:
from shapely.geometry import MultiPoint, Polygon
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("shapely not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# digital elevation models
elevation_dir = {}
Expand Down
6 changes: 0 additions & 6 deletions scripts/MPI_ICESat2_ATL03.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,20 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
try:
from mpi4py import MPI
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("mpi4py not available", ImportWarning)
try:
import sklearn.neighbors
import sklearn.cluster
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("scikit-learn not available", ImportWarning)
try:
import yapc.classify_photons
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("pyYAPC not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: keep track of MPI threads
def info(rank, size):
Expand Down
6 changes: 0 additions & 6 deletions scripts/MPI_ICESat2_ATL03_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,26 +128,20 @@
try:
import h5py
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("h5py not available", ImportWarning)
try:
from mpi4py import MPI
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("mpi4py not available", ImportWarning)
try:
import sklearn.neighbors
import sklearn.cluster
except (AttributeError, ImportError, ModuleNotFoundError) as exc:
warnings.filterwarnings("module")
warnings.warn("scikit-learn not available", ImportWarning)
try:
import yapc.classify_photons
except ModuleNotFoundError:
warnings.filterwarnings("module")
warnings.warn("pyYAPC not available", ImportWarning)
# ignore warnings
warnings.filterwarnings("ignore")

# PURPOSE: keep track of MPI threads
def info(rank, size):
Expand Down
Loading

0 comments on commit 74bef99

Please sign in to comment.