From 2480bbfcc136b47411121b2054bebbda82fa29ce Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Tue, 25 Oct 2022 13:02:03 -0800 Subject: [PATCH 01/18] Revert "move scipy/matplotlib/skimage into sub-func (#41)" This reverts commit cf2d0179878dcfdfc3eda0038d52530f5e368e0d. --- src/pysolid/grid.py | 2 +- src/pysolid/point.py | 7 ++----- src/pysolid/version.py | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pysolid/grid.py b/src/pysolid/grid.py index 967bfd1..3920943 100644 --- a/src/pysolid/grid.py +++ b/src/pysolid/grid.py @@ -15,6 +15,7 @@ import os import numpy as np +from skimage.transform import resize ################################## Earth tides - grid mode ################################### @@ -41,7 +42,6 @@ def calc_solid_earth_tides_grid(dt_obj, atr, step_size=1e3, display=False, verbo Examples: atr = readfile.read_attribute('geo_velocity.h5') tide_e, tide_n, tide_u = calc_solid_earth_tides_grid('20180219', atr) """ - from skimage.transform import resize try: from pysolid.solid import solid_grid except ImportError: diff --git a/src/pysolid/point.py b/src/pysolid/point.py index adb7302..07d109a 100644 --- a/src/pysolid/point.py +++ b/src/pysolid/point.py @@ -16,6 +16,8 @@ import os import numpy as np +from matplotlib import pyplot as plt, ticker, dates as mdates +from scipy import signal ## Tidal constituents @@ -203,8 +205,6 @@ def calc_solid_earth_tides_point_per_day(lat, lon, date_str, step_sec=60): def plot_solid_earth_tides_point(dt_out, tide_e, tide_n, tide_u, lalo=None, out_fig=None, save=False, display=True): """Plot the solid Earth tides at one point.""" - from matplotlib import pyplot as plt, dates as mdates - # plot fig, axs = plt.subplots(nrows=3, ncols=1, figsize=[6, 4], sharex=True) for ax, data, label in zip(axs.flatten(), @@ -247,9 +247,6 @@ def plot_power_spectral_density4tides(tide_ts, sample_spacing, out_fig=None, fig """Plot the power spectral density (PSD) of tides time-series. Note: for accurate PSD analysis, a long time-series, e.g. one year, is recommended. """ - from matplotlib import pyplot as plt, ticker - from scipy import signal - ## calc PSD freq, psd = signal.periodogram(tide_ts, fs=1/sample_spacing, scaling='density') # get rid of zero in the first element diff --git a/src/pysolid/version.py b/src/pysolid/version.py index 6c4d9e7..0ee7deb 100644 --- a/src/pysolid/version.py +++ b/src/pysolid/version.py @@ -12,7 +12,6 @@ # release history Tag = collections.namedtuple('Tag', 'version date') release_history = ( - Tag('0.2.4', '2022-10-24'), Tag('0.2.3', '2022-10-23'), Tag('0.2.2', '2022-07-20'), Tag('0.2.1', '2022-01-05'), From f504f151b920b99113aa6d4e45a4ea1130b595a0 Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Tue, 25 Oct 2022 13:32:07 -0800 Subject: [PATCH 02/18] switch to pyproject.toml and dynamic version number via setuptools_scm --- environment.yml | 7 +++++ pyproject.toml | 46 ++++++++++++++++++++++++++++ setup.py | 67 +---------------------------------------- src/pysolid/__init__.py | 23 +++++++++++++- src/pysolid/version.py | 62 -------------------------------------- 5 files changed, 76 insertions(+), 129 deletions(-) create mode 100644 pyproject.toml delete mode 100644 src/pysolid/version.py diff --git a/environment.yml b/environment.yml index b21dec6..37cb7a9 100644 --- a/environment.yml +++ b/environment.yml @@ -3,8 +3,15 @@ channels: - conda-forge - defaults dependencies: + - python>=3.8 + - pip + # For running - numpy - scipy - matplotlib - scikit-image - fortran-compiler # A generic way to obtain the Fortran compiler across platforms through conda-forge channel + # For packaging and distribution + - setuptools + - setuptools_scm + - wheel diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..995445d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +[build-system] +requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "pysolid" +authors = [ + {name='Zhang Yunjun', email='yunjunzgeo@gmail.com'}, + {name='Dennis Milbert', email=''}, +] +description = "A Python wrapper for solid to compute solid Earth tides" +readme = "README.md" +requires-python = ">=3.8" +keywords = ["solid Earth tides", "deformation", "geodesy", "geophysics"] +license = {text = "GPL-3.0-or-later"} +classifiers=[ + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", +] +dependencies = [ + 'numpy', + 'scipy', + 'matplotlib', + 'scikit-image', +] +dynamic = ["version"] + +[project.urls] +"Homepage" = "https://github.com/insarlab/PySolid" +"Bug Tracker" = "https://github.com/insarlab/PySolid/issues" + +[tool.setuptools] +include-package-data = true +zip-safe = false + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +pysolid = ["solid.for"] + +[tool.setuptools_scm] diff --git a/setup.py b/setup.py index f28aa09..fb23b09 100644 --- a/setup.py +++ b/setup.py @@ -1,74 +1,9 @@ # Author: Zhang Yunjun, Jan 2021 # Copyright 2020, by the California Institute of Technology. -# Note by Yunjun, Oct 2022: "pip install pysolid" does not work, -# because a Fortran compiler is required but not available via pip - - -import os -import sys - -# always prefer setuptools over distutils -import setuptools -from numpy.distutils.core import setup, Extension - -# Grab from pysolid.version: version -# link: https://stackoverflow.com/questions/53648900 -sys.path.append(os.path.join(os.path.dirname(__file__), 'src')) -from pysolid.version import version - -# Grab from README file: long_description -with open("README.md", "r") as f: - long_description = f.read() +from setuptools import setup, Extension setup( - name='pysolid', - version=version, - description="A Python wrapper for solid to compute solid Earth tides", - url="https://github.com/insarlab/PySolid", - download_url=("https://github.com/insarlab/PySolid/archive/v{}.tar.gz".format(version)), - long_description=long_description, - long_description_content_type="text/markdown", - author="Zhang Yunjun, Dennis Milbert", - author_email="yunjunzgeo@gmail.com", - license="GPL-3.0-or-later", - license_files=("LICENSE",), - - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Science/Research", - "Topic :: Scientific/Engineering", - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - ], - keywords="solid Eartth tides, deformation, geodesy, geophysics", - - project_urls={ - "Bug Reports": "https://github.com/insarlab/PySolid/issues", - "Source": "https://github.com/insarlab/PySolid", - }, - - # package discovery - packages=setuptools.find_packages("src"), # include all packages under src - package_dir={"": "src"}, # tell distutils packages are under src - - # build fortran deps with numpy.f2py ext_modules=[ Extension(name='pysolid.solid', sources=['src/pysolid/solid.for']), ], - - # dependencies - python_requires=">=3.6", - install_requires=[ - 'numpy', - 'scipy', - 'matplotlib', - 'scikit-image', - ], - - # data files - include_package_data=True, - package_data={ - "pysolid": ["solid.for"], - }, ) diff --git a/src/pysolid/__init__.py b/src/pysolid/__init__.py index 5c19a38..a047e03 100644 --- a/src/pysolid/__init__.py +++ b/src/pysolid/__init__.py @@ -1,5 +1,16 @@ +from importlib.metadata import PackageNotFoundError, version + # get version info -from pysolid.version import version as __version__ +try: + __version__ = version(__name__) +except PackageNotFoundError: + print('package is not installed!\n' + 'Install in editable/develop mode via (from the top of this repo):\n' + ' python -m pip install -e .\n' + 'Or, to just get the version number use:\n' + ' python -m setuptools_scm') + + # top-level functions from pysolid.grid import ( @@ -12,3 +23,13 @@ plot_solid_earth_tides_point, plot_power_spectral_density4tides, ) + +__all__ = [ + '__version__', + 'calc_solid_earth_tides_grid', + 'plot_solid_earth_tides_grid', + 'TIDES', + 'calc_solid_earth_tides_point', + 'plot_solid_earth_tides_point', + 'plot_power_spectral_density4tides', +] diff --git a/src/pysolid/version.py b/src/pysolid/version.py deleted file mode 100644 index 0ee7deb..0000000 --- a/src/pysolid/version.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -# Author: Zhang Yunjun, Jan 2021 -# Copyright 2020, by the California Institute of Technology. - - -import collections -import os -import subprocess - - -########################################################################### -# release history -Tag = collections.namedtuple('Tag', 'version date') -release_history = ( - Tag('0.2.3', '2022-10-23'), - Tag('0.2.2', '2022-07-20'), - Tag('0.2.1', '2022-01-05'), - Tag('0.2.0', '2021-11-10'), - Tag('0.1.2', '2021-02-24'), - Tag('0.1.1', '2021-02-01'), - Tag('0.1.0', '2021-01-22'), -) - -# latest release -release_version = release_history[0].version -release_date = release_history[0].date - -# get development version info -def get_version_info(): - """Grab version and date of the latest commit from a git repository""" - # go to the repository directory - dir_orig = os.getcwd() - os.chdir(os.path.dirname(os.path.dirname(__file__))) - - try: - # grab from git cmd - cmd = "git describe --tags" - version = subprocess.check_output(cmd.split(), stderr=subprocess.DEVNULL) - version = version.decode('utf-8').strip()[1:] - - # if there are new commits after the latest release - if '-' in version: - version, num_commit = version.split('-')[:2] - version += f'-{num_commit}' - - cmd = "git log -1 --date=short --format=%cd" - date = subprocess.check_output(cmd.split(), stderr=subprocess.DEVNULL) - date = date.decode('utf-8').strip() - - except: - # use the latest release version/date - version = release_version - date = release_date - - # go back to the original directory - os.chdir(dir_orig) - return version, date - - -########################################################################### -version, version_date = get_version_info() - From eb7b19e3e871b755731deab3558ff525143f59fa Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Tue, 25 Oct 2022 14:17:42 -0800 Subject: [PATCH 03/18] Fix (ish) build --- pyproject.toml | 7 ++++--- setup.py | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 995445d..ba5a9f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,13 @@ [build-system] -requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"] +requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2", "numpy", "wheel"] + build-backend = "setuptools.build_meta" [project] name = "pysolid" authors = [ {name='Zhang Yunjun', email='yunjunzgeo@gmail.com'}, - {name='Dennis Milbert', email=''}, + {name='Dennis Milbert'}, ] description = "A Python wrapper for solid to compute solid Earth tides" readme = "README.md" @@ -41,6 +42,6 @@ zip-safe = false where = ["src"] [tool.setuptools.package-data] -pysolid = ["solid.for"] +pysolid = ["*.for"] [tool.setuptools_scm] diff --git a/setup.py b/setup.py index fb23b09..3a3510b 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,9 @@ # Author: Zhang Yunjun, Jan 2021 # Copyright 2020, by the California Institute of Technology. -from setuptools import setup, Extension + +# always prefer setuptools over distutils +import setuptools +from numpy.distutils.core import setup, Extension setup( ext_modules=[ From e29f48d33c198ece41d7516d44471a82e0e070db Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Tue, 25 Oct 2022 14:20:56 -0800 Subject: [PATCH 04/18] fix readme spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78bb1d0..35c177f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ or via `apt` (or other package managers) for [Debian-derivative OS](https://wiki apt install python3-pysolid ``` -Installing via `conda` and `apt` is recomended because PySolid contains Fortran source code, which required compilcation. Otherwise, you may build it from source as described below. +Installing via `conda` and `apt` is recommended because PySolid contains Fortran source code, which required compilation. Otherwise, you may build it from source as described below. #### 1.1 Build from source From 1ac4dbef00a28cdc17d3869d460e44a09035507d Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Fri, 28 Oct 2022 08:18:11 -0800 Subject: [PATCH 05/18] add explination of editable install --- README.md | 7 +++++-- src/pysolid/__init__.py | 6 ++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 35c177f..52d9a01 100644 --- a/README.md +++ b/README.md @@ -56,10 +56,13 @@ python -m pip install -r PySolid/requirements.txt ```bash # option 1: use pip to install pysolid into the current environment -# use "pip install -e" to install in the development mode python -m pip install PySolid -# option 2: manually compile the Fortran code and setup environment variable +# option 2: use pip to install pysolid in develop mode (editable) into the current environment +export SETUPTOOLS_ENABLE_FEATURES="legacy-editable" +python -m pip install -e PySolid + +# option 3: manually compile the Fortran code and setup environment variable cd PySolid/src/pysolid f2py -c -m solid solid.for export PYTHONPATH=${PYTHONPATH}:~/tools/PySolid diff --git a/src/pysolid/__init__.py b/src/pysolid/__init__.py index a047e03..8093ff1 100644 --- a/src/pysolid/__init__.py +++ b/src/pysolid/__init__.py @@ -5,13 +5,11 @@ __version__ = version(__name__) except PackageNotFoundError: print('package is not installed!\n' - 'Install in editable/develop mode via (from the top of this repo):\n' - ' python -m pip install -e .\n' - 'Or, to just get the version number use:\n' + 'Please follow the installation instructions in the README.md.\n' + 'Or, to just get the version number, use:\n' ' python -m setuptools_scm') - # top-level functions from pysolid.grid import ( calc_solid_earth_tides_grid, From b00c5b49f9fcb507dea5f1b569f4799c7f405d33 Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Fri, 28 Oct 2022 13:03:59 -0800 Subject: [PATCH 06/18] update pypi workflow; add dependabot to keep actions up to date --- .github/dependabot.yml | 6 ++ .../workflows/build-and-publish-to-pypi.yml | 68 ++++++++++++++++++ .github/workflows/publish-to-test-pypi.yml | 72 ------------------- 3 files changed, 74 insertions(+), 72 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build-and-publish-to-pypi.yml delete mode 100644 .github/workflows/publish-to-test-pypi.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1230149 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build-and-publish-to-pypi.yml b/.github/workflows/build-and-publish-to-pypi.yml new file mode 100644 index 0000000..d8ec6e9 --- /dev/null +++ b/.github/workflows/build-and-publish-to-pypi.yml @@ -0,0 +1,68 @@ +name: Publish distributions 📦 to PyPI + +# Build on every branch push, tag push, and pull request change: +on: [push, pull_request] + +jobs: + build_wheels: + name: Build Python 🐍 wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, windows-2019, macos-11] + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.11.2 + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build Python 🐍 source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v3 + with: + path: dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + if: github.repository_owner == 'insarlab' & github.event_name == 'push' + steps: + - uses: actions/download-artifact@v3 + with: + # unpacks default artifact into dist/ + # if `name: artifact` is omitted, the action will create extra parent dir + name: artifact + path: dist + + - name: Publish developed version 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1.5.0 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: false + verbose: true + + - name: Publish released version 📦 to PyPI + uses: pypa/gh-action-pypi-publish@v1.5.0 + if: startsWith(github.ref, 'refs/tags/v') + with: + user: __token__ + password: ${{ secrets.pypi_password }} + verbose: true diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml deleted file mode 100644 index 942ffef..0000000 --- a/.github/workflows/publish-to-test-pypi.yml +++ /dev/null @@ -1,72 +0,0 @@ -# link: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ -name: publish distributions 📦 to PyPI and TestPyPI - -on: - push: - branches: - - main - tags: - - v* - -# activate miniconda environment -# link: https://github.com/marketplace/actions/provision-with-micromamba#IMPORTANT -defaults: - run: - shell: bash -l {0} - -jobs: - build-n-publish: - if: github.repository_owner == 'insarlab' - - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - # link: https://github.com/marketplace/actions/provision-with-micromamba - - name: Install Conda environment with Micromamba - uses: mamba-org/provision-with-micromamba@main - with: - environment-file: environment.yml - - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --no-isolation # not install in an isolated environment - --outdir dist/ - . - # skip due to the bad request error from pypi: - # binary wheel has an unsupported platform tag 'linux_x86_64' - #--wheel - - - name: Publish developed version 📦 to Test PyPI - if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - skip_existing: false - verbose: true - - - name: Publish released version 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/v') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - verbose: true From b7def2d3ac240d3a649c890e3302558186a4471b Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Fri, 28 Oct 2022 13:17:09 -0800 Subject: [PATCH 07/18] Fix typo; more restrictive for pushes --- .github/workflows/build-and-publish-to-pypi.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-publish-to-pypi.yml b/.github/workflows/build-and-publish-to-pypi.yml index d8ec6e9..d4d379a 100644 --- a/.github/workflows/build-and-publish-to-pypi.yml +++ b/.github/workflows/build-and-publish-to-pypi.yml @@ -1,7 +1,13 @@ name: Publish distributions 📦 to PyPI # Build on every branch push, tag push, and pull request change: -on: [push, pull_request] +on: + push: + branches: + - main + tags: + - v* + pull_request: jobs: build_wheels: @@ -41,7 +47,7 @@ jobs: upload_pypi: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest - if: github.repository_owner == 'insarlab' & github.event_name == 'push' + if: github.repository_owner == 'insarlab' && github.event_name == 'push' steps: - uses: actions/download-artifact@v3 with: From c14ffe0ac0b674e684a86e082047fc6f97bb32a0 Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Fri, 28 Oct 2022 13:23:11 -0800 Subject: [PATCH 08/18] Add git to circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fbf8a31..7f163a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ jobs: command: | apt update apt-get update --yes && apt-get upgrade --yes - apt-get install --yes wget + apt-get install --yes wget git # download and install miniconda3 mkdir -p ${HOME}/tools cd ${HOME}/tools From 8f31f5864baf36437c3414d832c0dfa61e8768b9 Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Fri, 28 Oct 2022 13:29:57 -0800 Subject: [PATCH 09/18] Update fortran build see: https://github.com/pypa/cibuildwheel/issues/404 --- .../workflows/build-and-publish-to-pypi.yml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/build-and-publish-to-pypi.yml b/.github/workflows/build-and-publish-to-pypi.yml index d4d379a..5247f92 100644 --- a/.github/workflows/build-and-publish-to-pypi.yml +++ b/.github/workflows/build-and-publish-to-pypi.yml @@ -22,8 +22,34 @@ jobs: with: fetch-depth: 0 + - name: Provide gfortran (macOS) + if: runner.os == 'macOS' + run: | + # https://github.com/actions/virtual-environments/issues/2524 + # https://github.com/cbg-ethz/dce/blob/master/.github/workflows/pkgdown.yaml + sudo ln -s /usr/local/bin/gfortran-11 /usr/local/bin/gfortran + sudo mkdir /usr/local/gfortran + sudo ln -s /usr/local/Cellar/gcc@11/*/lib/gcc/11 /usr/local/gfortran/lib + gfortran --version + + - name: Provide gfortran (Windows) + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + + - name: Tell distutils to use mingw (Windows) + if: runner.os == 'Windows' + run: | + echo "[build]`ncompiler=mingw32" | Out-File -Encoding ASCII ~/pydistutils.cfg + - name: Build wheels uses: pypa/cibuildwheel@v2.11.2 + env: + # Disable building for PyPy and 32bit. + CIBW_SKIP: pp* *-win32 *-manylinux_i686 + # Package the DLL dependencies in the wheel for windows (done by default for the other platforms). + # delvewheel cannot mangle the libraries, stripping does not work. + CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel show {wheel} && delvewheel repair -w {dest_dir} {wheel} --no-mangle-all" - uses: actions/upload-artifact@v3 with: From d314a1ff9c90785f4fc1dd025455f6f66cafdcf7 Mon Sep 17 00:00:00 2001 From: Joseph H Kennedy Date: Fri, 28 Oct 2022 13:38:32 -0800 Subject: [PATCH 10/18] don't fail fast for builds --- .github/workflows/build-and-publish-to-pypi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-publish-to-pypi.yml b/.github/workflows/build-and-publish-to-pypi.yml index 5247f92..829cfce 100644 --- a/.github/workflows/build-and-publish-to-pypi.yml +++ b/.github/workflows/build-and-publish-to-pypi.yml @@ -14,6 +14,7 @@ jobs: name: Build Python 🐍 wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-20.04, windows-2019, macos-11] From a92827f5e5efd5baaacc300a40581c2ad3871678 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Wed, 2 Nov 2022 15:11:58 -0700 Subject: [PATCH 11/18] add comments on f2py --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 3a3510b..1a4a3a6 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ from numpy.distutils.core import setup, Extension setup( + # fortran extensions to build with numpy.f2py ext_modules=[ Extension(name='pysolid.solid', sources=['src/pysolid/solid.for']), ], From 51a93cc6eb6e777caf3b841edecb46b654341520 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Wed, 2 Nov 2022 15:20:11 -0700 Subject: [PATCH 12/18] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 52d9a01..6775861 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ python -m pip install -r PySolid/requirements.txt python -m pip install PySolid # option 2: use pip to install pysolid in develop mode (editable) into the current environment +# setting an environmental variable as below is required for editable installs via pyproject.toml export SETUPTOOLS_ENABLE_FEATURES="legacy-editable" python -m pip install -e PySolid From 50d06e3b4b9cbe46f6405d30bd656c8aade7e770 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Wed, 2 Nov 2022 15:59:49 -0700 Subject: [PATCH 13/18] use PYPI_API_TOKEN --- .github/workflows/build-and-publish-to-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish-to-pypi.yml b/.github/workflows/build-and-publish-to-pypi.yml index 829cfce..98bb42f 100644 --- a/.github/workflows/build-and-publish-to-pypi.yml +++ b/.github/workflows/build-and-publish-to-pypi.yml @@ -97,5 +97,5 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: user: __token__ - password: ${{ secrets.pypi_password }} + password: ${{ secrets.PYPI_API_TOKEN }} verbose: true From 034e261b1d4b6c21e07342ac4bec2bb61a9e4b03 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Wed, 2 Nov 2022 19:52:54 -0700 Subject: [PATCH 14/18] pyproject.toml: indentation adjustment --- pyproject.toml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ba5a9f1..893fb37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,18 +15,18 @@ requires-python = ">=3.8" keywords = ["solid Earth tides", "deformation", "geodesy", "geophysics"] license = {text = "GPL-3.0-or-later"} classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Science/Research", - "Topic :: Scientific/Engineering", - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", ] dependencies = [ - 'numpy', - 'scipy', - 'matplotlib', - 'scikit-image', + 'numpy', + 'scipy', + 'matplotlib', + 'scikit-image', ] dynamic = ["version"] From d769e93afa7c700d54722b8b4a14a3d423de19e0 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Wed, 2 Nov 2022 20:37:02 -0700 Subject: [PATCH 15/18] Update build-and-publish-to-pypi.yml --- .github/workflows/build-and-publish-to-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish-to-pypi.yml b/.github/workflows/build-and-publish-to-pypi.yml index 98bb42f..785680a 100644 --- a/.github/workflows/build-and-publish-to-pypi.yml +++ b/.github/workflows/build-and-publish-to-pypi.yml @@ -1,4 +1,4 @@ -name: Publish distributions 📦 to PyPI +name: Publish 📦 to PyPI # Build on every branch push, tag push, and pull request change: on: From 73ceb4f5542f0142a547a2506c1019d1fe5b5456 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Thu, 3 Nov 2022 11:17:21 -0700 Subject: [PATCH 16/18] setuptools_scm: set version/local_scheme --- pyproject.toml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 893fb37..f8152fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,8 +6,8 @@ build-backend = "setuptools.build_meta" [project] name = "pysolid" authors = [ - {name='Zhang Yunjun', email='yunjunzgeo@gmail.com'}, - {name='Dennis Milbert'}, + {name="Zhang Yunjun", email="yunjunzgeo@gmail.com"}, + {name="Dennis Milbert"}, ] description = "A Python wrapper for solid to compute solid Earth tides" readme = "README.md" @@ -23,10 +23,10 @@ classifiers=[ "Programming Language :: Python :: 3", ] dependencies = [ - 'numpy', - 'scipy', - 'matplotlib', - 'scikit-image', + "numpy", + "scipy", + "matplotlib", + "scikit-image", ] dynamic = ["version"] @@ -45,3 +45,5 @@ where = ["src"] pysolid = ["*.for"] [tool.setuptools_scm] +version_scheme = "post-release" +local_scheme = "no-local-version" From efc8a1760876054e87e3785a67cd92fae8639d86 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Thu, 3 Nov 2022 11:18:09 -0700 Subject: [PATCH 17/18] build/publish to pypi: skip windows --- .github/workflows/build-and-publish-to-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish-to-pypi.yml b/.github/workflows/build-and-publish-to-pypi.yml index 785680a..6c1fb14 100644 --- a/.github/workflows/build-and-publish-to-pypi.yml +++ b/.github/workflows/build-and-publish-to-pypi.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2019, macos-11] + os: [ubuntu-20.04, macos-11] #windows-2019 steps: - uses: actions/checkout@v3 From 093291f5db8c7478d9470b53475ac1e48a3c5074 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Thu, 3 Nov 2022 11:27:32 -0700 Subject: [PATCH 18/18] deps: update requirements.txt to be consistent with environment.yml file --- environment.yml | 8 ++++---- requirements.txt | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/environment.yml b/environment.yml index 37cb7a9..8f069af 100644 --- a/environment.yml +++ b/environment.yml @@ -4,14 +4,14 @@ channels: - defaults dependencies: - python>=3.8 - - pip - # For running + # for running - numpy - scipy - matplotlib - scikit-image - - fortran-compiler # A generic way to obtain the Fortran compiler across platforms through conda-forge channel - # For packaging and distribution + # for packaging and installation + - fortran-compiler # Fortran compiler across platforms through conda-forge channel + - pip - setuptools - setuptools_scm - wheel diff --git a/requirements.txt b/requirements.txt index 2aa8729..2a32a24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,11 @@ +# for running numpy scipy matplotlib scikit-image +# for packaging and installation +#fortran-compiler # Fortran compiler across platforms through conda-forge channel +pip +setuptools +setuptools_scm +wheel