Repository: fhs/pyhdf (language: python)

Issue:
Update cibuildwheel to include wheels for 3.10 (and drop 3.5)
Hi there!

I was installing pyhdf in a python 3.10 environment and it initially failed due to missing header files ("hdf.h").
Therefore, I went ahead and updated the used cibuildwheel version, which now is able to build python 3.10 build targets.
Unfortunately, in the same process python 3.5 was dropped. If 3.5 wheels are needed, we can add another build step to use the old cibuildwheel version to build them.

With the update, the following packages will be build:
 - pyhdf-0.10.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
 - pyhdf-0.10.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
 - pyhdf-0.10.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
 - pyhdf-0.10.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
 - pyhdf-0.10.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
 - pyhdf-0.10.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
 - pyhdf-0.10.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

To complete the automated build, we also could add mac-os and windows builds, if needed.
Let me know what you think, happy to help!


Discussion / hints:
Just had a 3.10 request come up, myself.  Confirmed that this change, along with a tag/version bump this would update wheels.  

https://github.com/abrammer/pyhdf/actions/runs/2174726838

Sorry about the delay. pyhdf 0.10.4 with python 3.10 wheel has been released.

Fix patch:
diff --git a/.appveyor.yml b/.appveyor.yml
deleted file mode 100644
index dd6dbde..0000000
--- a/.appveyor.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-# Based on https://packaging.python.org/guides/supporting-windows-using-appveyor/
-# and https://github.com/Anaconda-Platform/anaconda-project/blob/master/appveyor.yml
-
-environment:
-  matrix:
-    # For Miniconda versions available on Appveyor, see
-    # https://www.appveyor.com/docs/windows-images-software/#miniconda
-    - MINICONDA: C:\Miniconda
-    - MINICONDA: C:\Miniconda-x64
-    - MINICONDA: C:\Miniconda3
-    - MINICONDA: C:\Miniconda3-x64
-
-install:
-  # conda 4.5.11 seems to expect that this directory exists already
-  - mkdir C:\Users\appveyor\.conda
-  - call %MINICONDA%\Scripts\activate.bat
-  # The safety checks are simply intended to ensure that there is enough disk space
-  # and the user has the necessary permissions to make environment changes. In a CI
-  # environment these are not necessary and slow things down noticeably on Windows.
-  - conda config --set always_yes yes --set changeps1 no --set auto_update_conda no --set safety_checks disabled
-  - conda install -q conda numpy hdf4 nose
-  - conda info -a
-  # We need wheel installed to build wheels
-  - pip install wheel
-
-build: off
-
-test_script:
-  # Put your test command here.
-  - set LIBRARY_DIRS=%MINICONDA%\Library\bin;%MINICONDA%\Library\lib
-  - set INCLUDE_DIRS=%MINICONDA%\Library\include
-  - python setup.py nosetests -v
-  - python examples\runall.py
-
-after_test:
-  # This step builds your wheels.
-  - python setup.py bdist_wheel
-
-artifacts:
-  # bdist_wheel puts your built wheel in the dist directory
-  - path: dist\*
-
-#on_success:
-#  You can use this step to upload your artifacts to a public website.
-#  See Appveyor's documentation for more details. Or you can simply
-#  access your wheels from the Appveyor "artifacts" tab for your build.
diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml
index 5000f97..61c77e3 100644
--- a/.github/workflows/package.yml
+++ b/.github/workflows/package.yml
@@ -1,4 +1,4 @@
-name: package into static linked wheel
+name: Pypi build
 
 on:
   push:
@@ -6,10 +6,16 @@ on:
     - 'v*' #
 
 jobs:
-    package:
-        name: package up into a nice wheel
-        runs-on: ubuntu-latest
-        
+    packages:
+        name: Wheels on ${{ matrix.os }} (${{ matrix.cibw_archs }})
+        runs-on: ${{ matrix.os }}
+        strategy:
+          fail-fast: true
+          matrix:
+            os: [windows-latest, ubuntu-latest, macos-latest]
+            cibw_archs: ["auto"]
+        env:
+          CIBW_SKIP: "*-musllinux_*"
         steps:
         - uses: actions/checkout@v2
 
@@ -18,49 +24,97 @@ jobs:
           with:
             python-version: '3.7'
 
+        - name: Setup conda (windows-latest)
+          if: matrix.os == 'windows-latest'
+          uses: s-weigand/setup-conda@v1
+
+        - name: Setup conda paths (windows-latest)
+          if: matrix.os == 'windows-latest'
+          run: |
+            echo "LIBRARY_DIRS=C:\Miniconda\Library\lib;C:\Miniconda\Library\bin" >> $env:GITHUB_ENV
+            echo "INCLUDE_DIRS=C:\Miniconda\Library\include" >> $env:GITHUB_ENV
+
         - name: Install cibuildwheel
           run: |
             python -m pip install cibuildwheel==2.3.1
-
-        - name: Build wheels for linux python versions
+        - name: Build wheels
           run: |
             python -m cibuildwheel --output-dir dist
           env:
-            CIBW_BUILD: '{cp,pp}3*-many*'
+            CIBW_BUILD: '{cp,pp}3*'
             CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
             CIBW_BEFORE_ALL_LINUX: yum -y install epel-release hdf hdf-devel && ln -s /usr/lib64/hdf/lib* /usr/lib64/
-            CIBW_ARCHS_LINUX: 'x86_64'
-        
-        - name: purge old _linux_wheels
+            CIBW_ARCHS_LINUX: 'x86_64'  # restrict to 64bit builds
+            CIBW_ARCHS_WINDOWS: 'AMD64'  # restrict to 64bit builds
+            # (mac-os) Install hdf-4.2.15 from sources
+            CIBW_BEFORE_ALL_MACOS: >
+              brew install ninja &&
+              cd /tmp &&
+              git clone https://github.com/HDFGroup/hdf4.git &&
+              mkdir build && cd build &&
+              ../hdf4/configure --enable-shared --disable-static --disable-fortran --disable-netcdf --enable-production --with-zlib --prefix=/usr/local &&
+              make install
+            CIBW_BEFORE_ALL_WINDOWS: >
+              conda config --set always_yes yes --set changeps1 no --set auto_update_conda no --set safety_checks disabled &&
+              conda install -q hdf4
+        - name: Copy wheels into wheelhouse
           run: |
             mkdir wheelhouse
-            cp dist/*manylinux* wheelhouse/
-        
-        - name: create source distribution archive for pypi
-          run: |
-            python -m pip install numpy
-            python setup.py sdist -d wheelhouse
-
+            cp dist/*.whl wheelhouse
         - uses: actions/upload-artifact@v2
           with:
             name: wheelhouse
             path: wheelhouse
 
-        - name: Publish a Python distribution to Test PyPI
-          uses: pypa/gh-action-pypi-publish@release/v1
-          with:
-            user: __token__
-            password: ${{ secrets.PYPI_TEST_TOKEN }}
-            repository_url: https://test.pypi.org/legacy/
-            packages_dir: wheelhouse/
-            verbose: true
+    publish:
+        name: Publish to PyPI
+        needs: [packages]
+        runs-on: ubuntu-latest
+        steps:
+          - uses: actions/checkout@v2
 
-        - name: Publish a Python distribution to PyPI
-          if: github.event.base_ref == 'refs/heads/master'
-          uses: pypa/gh-action-pypi-publish@release/v1
-          with:
-            user: __token__
-            password: ${{ secrets.PYPI_API_TOKEN }}
-            packages_dir: wheelhouse/
+          - name: Switch to using Python 3.x
+            uses: actions/setup-python@v2
+            with:
+              python-version: 3.x
+
+          - name: Create source distribution archive
+            run: |
+              python -m pip install numpy
+              python setup.py sdist -d wheelhouse
+
+          - uses: actions/upload-artifact@v2
+            with:
+              name: wheelhouse
+              path: wheelhouse
+
+          - name: Publish SDIST to PyPI  # there are some problems if sdist is not pushed first
+            if: github.event.base_ref == 'refs/heads/master'
+            uses: pypa/gh-action-pypi-publish@release/v1
+            with:
+              user: __token__
+              password: ${{ secrets.PYPI_API_TOKEN }}
+              packages_dir: wheelhouse/
+
+          - name: Download all the wheels
+            uses: actions/download-artifact@v2
+            with:
+              name: wheelhouse
+              path: ./wheelhouse/
 
+          - name: Publish a Python distribution to Test PyPI
+            uses: pypa/gh-action-pypi-publish@release/v1
+            with:
+              user: __token__
+              password: ${{ secrets.PYPI_TEST_TOKEN }}
+              repository_url: https://test.pypi.org/legacy/
+              packages_dir: wheelhouse/
+              verbose: true
 
+          - name: Publish a Python distribution to PyPI
+            if: github.event.base_ref == 'refs/heads/master'
+            uses: pypa/gh-action-pypi-publish@release/v1
+            with:
+              user: __token__
+              password: ${{ secrets.PYPI_API_TOKEN }}
+              packages_dir: wheelhouse/
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 1819c63..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-language: python
-
-matrix:
-  include:
-    - os: linux
-      python: "2.7"
-    - os: linux
-      python: "3.4"
-    - os: linux
-      python: "3.5"
-    - os: linux
-      python: "3.6"
-    - os: osx
-      language: generic
-      env: PYHDF_PYTHON_VERSION="2.7"
-    - os: osx
-      language: generic
-      env: PYHDF_PYTHON_VERSION="3.7"
-
-addons:
-  apt:
-    packages:
-      - libhdf4-dev
-
-before_install:
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source ./.travis/install_osx_miniconda.bash; fi
-
-# command to run tests
-script:
-  - python setup.py nosetests -v
-  - python examples/runall.py
-
-notifications:
-  email:
-    recipients:
-      - fshahriar@gmail.com
-    on_success: never
-    on_failure: change
diff --git a/.travis/install_osx_miniconda.bash b/.travis/install_osx_miniconda.bash
deleted file mode 100755
index 2cc9962..0000000
--- a/.travis/install_osx_miniconda.bash
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-# We do this conditionally because it saves us some downloading if the
-# version is the same.
-if [[ "$PYHDF_PYTHON_VERSION" == "2.7" ]]; then
-	curl https://repo.anaconda.com/miniconda/Miniconda2-latest-MacOSX-x86_64.sh > miniconda.sh;
-else
-	curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh > miniconda.sh;
-fi
-bash miniconda.sh -b -p $HOME/miniconda
-export PATH="$HOME/miniconda/bin:$PATH"
-hash -r
-conda config --set always_yes yes --set changeps1 no
-conda update -q conda
-# Useful for debugging any issues with conda
-conda info -a
-
-conda create -q -n test-environment python=$PYHDF_PYTHON_VERSION numpy hdf4 nose
-source activate test-environment
-
-export LIBRARY_DIRS=$CONDA_PREFIX/lib
-export INCLUDE_DIRS=$CONDA_PREFIX/include
diff --git a/README.md b/README.md
index 23a88b2..367e39e 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-[![Build Status](https://travis-ci.org/fhs/pyhdf.svg?branch=master)](https://travis-ci.org/fhs/pyhdf)
-[![Build status](https://ci.appveyor.com/api/projects/status/4a8pf8vo8nrjgxol/branch/master?svg=true)](https://ci.appveyor.com/project/fhs/pyhdf/branch/master)
+[![Tests](https://github.com/fhs/pyhdf/actions/workflows/tests.yml/badge.svg)](https://github.com/fhs/pyhdf/actions/workflows/tests.yml)
+[![Pypi build](https://github.com/fhs/pyhdf/actions/workflows/package.yml/badge.svg)](https://github.com/fhs/pyhdf/actions/workflows/package.yml)
 [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pyhdf/badges/version.svg)](https://anaconda.org/conda-forge/pyhdf)
 
 # pyhdf
diff --git a/doc/conf.py b/doc/conf.py
index 3cdbe93..44a3e0b 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -56,7 +56,7 @@
 # The short X.Y version.
 version = '0.10'
 # The full version, including alpha/beta/rc tags.
-release = '0.10.4'
+release = '0.10.5'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/setup.py b/setup.py
index cddc2bf..bdbebc6 100644
--- a/setup.py
+++ b/setup.py
@@ -153,7 +153,7 @@ def _use_hdf4alt(libdirs):
       license      = 'MIT',
       long_description = "\n".join(DOCLINES[2:]),
       url          = 'https://github.com/fhs/pyhdf',
-      version      = '0.10.4',
+      version      = '0.10.5',
       packages     = ['pyhdf'],
       ext_modules  = [_hdfext],
       data_files   = data_files,


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index f5eb5e9..0da8af9 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -1,4 +1,4 @@
-name: Test package
+name: Tests
 
 concurrency:
   group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.type }}