diff --git a/.circleci/config.yml b/.circleci/config.yml index ab1680f..3eceb54 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 git wget # download and install miniconda3 mkdir -p ${HOME}/tools cd ${HOME}/tools @@ -45,23 +45,21 @@ jobs: ${HOME}/tools/miniconda3/bin/conda init bash ${HOME}/tools/miniconda3/bin/conda config --add channels conda-forge ${HOME}/tools/miniconda3/bin/conda install -c conda-forge --yes mamba + # modify/export env var PATH to BASH_ENV to be shared across run steps + echo 'export PATH=${CONDA_PREFIX}/bin:${PATH}' >> ${BASH_ENV} + - run: name: Installing PyAPS no_output_timeout: 10m command: | export PYTHONUNBUFFERED=1 - # setup environment variable - export PATH=${CONDA_PREFIX}/bin:${PATH} # install dependencies source activate root - mamba install --verbose --yes fortran-compiler --file ${HOME}/tools/PyAPS/requirements.txt + mamba install --verbose --yes --file ${HOME}/tools/PyAPS/requirements.txt python -m pip install ${HOME}/tools/PyAPS - run: name: Test the Installation command: | - # setup environment variables - export PATH=${CONDA_PREFIX}/bin:${PATH} - # run tests python ${HOME}/tools/PyAPS/tests/test_calc.py diff --git a/README.md b/README.md index 02cf193..4fec7de 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Language](https://img.shields.io/badge/python-3.6%2B-blue.svg)](https://www.python.org/) +[![Language](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/) [![CircleCI](https://img.shields.io/circleci/build/github/insarlab/PyAPS.svg?logo=circleci&label=test)](https://circleci.com/gh/insarlab/PyAPS) [![Version](https://img.shields.io/github/v/release/insarlab/PyAPS?color=green)](https://github.com/insarlab/PyAPS/releases) [![License](https://img.shields.io/badge/license-GPLv3+-yellow.svg)](https://github.com/insarlab/PyAPS/blob/main/LICENSE) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a98cb70 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,52 @@ +[build-system] +requires = ["setuptools>=61.0", "setuptools_scm[toml]", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "pyaps3" +description = "Python based Atmospheric Phase Screen estimation" +authors = [ + {name="Romain Jolivet", email="insar@geologie.ens.fr"}, + {name="Angelique Benoit"}, +] +readme = "README.md" +requires-python = ">=3.8" +keywords = ["InSAR", "troposphere", "geodesy", "geophysics", "ERA5"] +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 = [ + "cdsapi", + "matplotlib", + "numpy", + "pygrib", + "scipy", + "urllib3", + #"netcdf4", # for MERRA, which is currently not supported + #"pyhdf", # for MERRA, which is currently not supported +] +dynamic = ["version"] + +[project.urls] +"Homepage" = "https://github.com/insarlab/PyAPS" +"Bug Tracker" = "https://github.com/insarlab/PyAPS/issues" + +[tool.setuptools] +include-package-data = true +zip-safe = false + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +pysolid = ["*.cfg"] + +[tool.setuptools_scm] +version_scheme = "post-release" +local_scheme = "no-local-version" diff --git a/requirements.txt b/requirements.txt index a3df1c8..79dbc5f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +# for running cdsapi matplotlib numpy @@ -6,4 +7,8 @@ scipy urllib3 #netcdf4 #for MERRA, which is currently not supported #pyhdf #for MERRA, which is currently not supported - +# for packaging and installation +pip +setuptools +setuptools_scm +wheel \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 08d39a7..0000000 --- a/setup.py +++ /dev/null @@ -1,70 +0,0 @@ -# Author: Zhang Yunjun, Panji Brotoisworo, Jan 2021 - -# always prefer setuptools over distutils -from setuptools import setup, find_packages - - -# Grab from version.py file: version -with open("src/pyaps3/version.py", "r") as f: - lines = f.readlines() - line = [line for line in lines if line.strip().startswith("Tag(")][0].strip() - version = line.replace("'",'"').split('"')[1] - - -# Grab from README file: long_description -with open("README.md", "r") as f: - long_description = f.read() - - -setup( - name='pyaps3', - version=version, - description="Python based Atmospheric Phase Screen Estimation", - url="https://github.com/insarlab/PyAPS", - download_url=("https://github.com/insarlab/PyAPS/archive/v{}.tar.gz".format(version)), - long_description=long_description, - long_description_content_type="text/markdown", - author="Romain Jolivet, Angelique Benoit", - author_email="insar@geologie.ens.fr", - 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="InSAR, troposphere, geodesy, geophysics, ERA5", - - project_urls={ - "Bug Reports": "https://github.com/insarlab/PyAPS/issues", - "Documentation": "https://github.com/insarlab/PyAPS/tree/main/docs", - "Source": "https://github.com/insarlab/PyAPS", - }, - - # package discovery - packages=find_packages("src"), # include all packages under src - package_dir={"": "src"}, # tell distutils packages are under src - - # dependencies - python_requires=">=3.6", - install_requires=[ - 'cdsapi', - 'matplotlib', - 'numpy', - 'pygrib', - 'scipy', - 'urllib3', - # 'netcdf4', #for MERRA, which is currently not supported - # 'pyhdf', #for MERRA, which is currently not supported - ], - - # data files - include_package_data=True, - package_data={ - "pyaps3": ["*.cfg"], - }, -) diff --git a/src/pyaps3/__init__.py b/src/pyaps3/__init__.py index e24970d..eb78af7 100644 --- a/src/pyaps3/__init__.py +++ b/src/pyaps3/__init__.py @@ -1,19 +1,29 @@ ''' PyAPS module to compute InSAR phase delay maps from weather models. -Written by Romain Jolivet and Piyush Agram . The original Fortran package was written by Romain Jolivet and the Python version including support for different models was written by Piyush Agram. +Written by Romain Jolivet and Piyush Agram . +The original Fortran package was written by Romain Jolivet and the Python version including +support for different models was written by Piyush Agram. .. note:: - Details of the python module can be obtained `here. `_ + Details of the python module can be obtained `here. ` ''' -__all__ = ['autoget','objects'] +# get version info [requires python >=3.8] +from importlib.metadata import PackageNotFoundError, version +try: + __version__ = version(__name__) +except PackageNotFoundError: + print('package is not installed!\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 pyaps3.objects import PyAPS from pyaps3.autoget import ECMWFdload, MERRAdload, NARRdload -# get version info -from pyaps3.version import release_version as __version__ +__all__ = ['__version__', 'PyAPS', 'ECMWFdload', 'MERRAdload', 'NARRdload'] ############################################################ # Program is part of PyAPS # diff --git a/src/pyaps3/version.py b/src/pyaps3/version.py deleted file mode 100644 index f9339bb..0000000 --- a/src/pyaps3/version.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 -# Author: Zhang Yunjun, Nov 2021 -# Copyright 2012, by the California Institute of Technology. - - -import collections - -# release history -Tag = collections.namedtuple('Tag', 'version date') -release_history = ( - Tag('0.3.2', '2022-12-20'), - Tag('0.3.1', '2021-11-26'), - Tag('0.3.0', '2021-11-15'), - Tag('0.2.0', '2021-08-31'), - Tag('0.1.0', '2019-04-07'), -) - -# latest release -release_version = 'v{}'.format(release_history[0].version) -release_date = release_history[0].date -