From d1b793bceed5cf6951015733f461d340d9c755e0 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Tue, 5 Dec 2023 10:03:17 +0800 Subject: [PATCH] replace `setup.py` with `pyproject.toml` (#1129) + add `tests/requirements.txt` file for test requirements + `requirements.txt`: move pre-commit into the `tests/requirements.txt` file + replace `setup.py` with `pyproject.toml` + bump the min python version to 3.8 --------- Co-authored-by: Scott Staniewicz --- docs/README.md | 2 +- pyproject.toml | 129 ++++++++++++++++++++++++++++- requirements.txt | 6 -- setup.py | 180 ----------------------------------------- tests/requirements.txt | 5 ++ 5 files changed, 134 insertions(+), 188 deletions(-) delete mode 100644 setup.py create mode 100644 tests/requirements.txt diff --git a/docs/README.md b/docs/README.md index 46cf6559e..79889a6e4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -[![Language](https://img.shields.io/badge/python-3.6%2B-blue.svg?style=flat-square)](https://www.python.org/) +[![Language](https://img.shields.io/badge/python-3.8%2B-blue.svg?style=flat-square)](https://www.python.org/) [![Docs Status](https://readthedocs.org/projects/mintpy/badge/?version=latest&style=flat-square)](https://mintpy.readthedocs.io/?badge=latest) [![CircleCI](https://img.shields.io/circleci/build/github/insarlab/MintPy.svg?logo=circleci&label=tests&style=flat-square)](https://circleci.com/gh/insarlab/MintPy) [![Docker Status](https://img.shields.io/github/actions/workflow/status/insarlab/MintPy/build-docker.yml?label=docker&style=flat-square&logo=docker&logoColor=white)](https://github.com/insarlab/MintPy/pkgs/container/mintpy) diff --git a/pyproject.toml b/pyproject.toml index 9787c3bdf..d9464d034 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,130 @@ [build-system] -requires = ["setuptools", "wheel"] +requires = ["setuptools>=64.0", "setuptools_scm[toml]"] build-backend = "setuptools.build_meta" + +[project] +name = "mintpy" +description = "Miami INsar Time-series software in PYthon" +authors = [ + { name = "Zhang Yunjun", email = "yunjunz@outlook.com" }, + { name = "Heresh Fattahi", email = "hersh.fattahi@gmail.com" }, +] +readme = { file = "README.md", content-type = "text/markdown" } +requires-python = ">=3.8" + +keywords = ["InSAR", "deformation", "time-series", "volcano", "tectonics", "geodesy", "geophysics", "remote-sensing"] +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", +] + +# see section: setuptools_scm +# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata +# dependencies will be read from text files +dynamic = ["version", "dependencies", "optional-dependencies"] + +[project.urls] +Homepage = "https://github.com/insarlab/MintPy" +Documentation = "https://mintpy.readthedocs.io/" +Issues = "https://github.com/insarlab/MintPy/issues" + +# Entry points for the command line interface +[project.scripts] +mintpy = "mintpy.__main__:main" +"add.py" = "mintpy.cli.add:main" +"asc_desc2horz_vert.py" = "mintpy.cli.asc_desc2horz_vert:main" +"closure_phase_bias.py" = "mintpy.cli.closure_phase_bias:main" +"dem_error.py" = "mintpy.cli.dem_error:main" +"dem_gsi.py" = "mintpy.cli.dem_gsi:main" +"diff.py" = "mintpy.cli.diff:main" +"generate_mask.py" = "mintpy.cli.generate_mask:main" +"geocode.py" = "mintpy.cli.geocode:main" +"ifgram_inversion.py" = "mintpy.cli.ifgram_inversion:main" +"image_math.py" = "mintpy.cli.image_math:main" +"image_stitch.py" = "mintpy.cli.image_stitch:main" +"info.py" = "mintpy.cli.info:main" +"iono_tec.py" = "mintpy.cli.iono_tec:main" +"load_data.py" = "mintpy.cli.load_data:main" +"load_gbis.py" = "mintpy.cli.load_gbis:main" +"local_oscilator_drift.py" = "mintpy.cli.local_oscilator_drift:main" +"lookup_geo2radar.py" = "mintpy.cli.lookup_geo2radar:main" +"mask.py" = "mintpy.cli.mask:main" +"modify_network.py" = "mintpy.cli.modify_network:main" +"multilook.py" = "mintpy.cli.multilook:main" +"multi_transect.py" = "mintpy.multi_transect:main" +"plate_motion.py" = "mintpy.cli.plate_motion:main" +"plot_coherence_matrix.py" = "mintpy.cli.plot_coherence_matrix:main" +"plot_network.py" = "mintpy.cli.plot_network:main" +"plot_transection.py" = "mintpy.cli.plot_transection:main" +"prep_aria.py" = "mintpy.cli.prep_aria:main" +"prep_cosicorr.py" = "mintpy.cli.prep_cosicorr:main" +"prep_fringe.py" = "mintpy.cli.prep_fringe:main" +"prep_gamma.py" = "mintpy.cli.prep_gamma:main" +"prep_gmtsar.py" = "mintpy.cli.prep_gmtsar:main" +"prep_hyp3.py" = "mintpy.cli.prep_hyp3:main" +"prep_isce.py" = "mintpy.cli.prep_isce:main" +"prep_nisar.py" = "mintpy.cli.prep_nisar:main" +"prep_roipac.py" = "mintpy.cli.prep_roipac:main" +"prep_snap.py" = "mintpy.cli.prep_snap:main" +"reference_date.py" = "mintpy.cli.reference_date:main" +"reference_point.py" = "mintpy.cli.reference_point:main" +"remove_hdf5_dset.py" = "mintpy.cli.remove_hdf5_dset:main" +"remove_ramp.py" = "mintpy.cli.remove_ramp:main" +"s1ab_range_bias.py" = "mintpy.cli.s1ab_range_bias:main" +"save_gbis.py" = "mintpy.cli.save_gbis:main" +"save_gdal.py" = "mintpy.cli.save_gdal:main" +"save_gmt.py" = "mintpy.cli.save_gmt:main" +"save_hdfeos5.py" = "mintpy.cli.save_hdfeos5:main" +"save_kite.py" = "mintpy.cli.save_kite:main" +"save_kmz.py" = "mintpy.cli.save_kmz:main" +"save_kmz_timeseries.py" = "mintpy.cli.save_kmz_timeseries:main" +"save_qgis.py" = "mintpy.cli.save_qgis:main" +"save_roipac.py" = "mintpy.cli.save_roipac:main" +"smallbaselineApp.py" = "mintpy.cli.smallbaselineApp:main" +"solid_earth_tides.py" = "mintpy.cli.solid_earth_tides:main" +"spatial_average.py" = "mintpy.cli.spatial_average:main" +"spatial_filter.py" = "mintpy.cli.spatial_filter:main" +"subset.py" = "mintpy.cli.subset:main" +"temporal_average.py" = "mintpy.cli.temporal_average:main" +"temporal_derivative.py" = "mintpy.cli.temporal_derivative:main" +"temporal_filter.py" = "mintpy.cli.temporal_filter:main" +"timeseries2velocity.py" = "mintpy.cli.timeseries2velocity:main" +"timeseries_rms.py" = "mintpy.cli.timeseries_rms:main" +"tropo_gacos.py" = "mintpy.cli.tropo_gacos:main" +"tropo_phase_elevation.py" = "mintpy.cli.tropo_phase_elevation:main" +"tropo_pyaps3.py" = "mintpy.cli.tropo_pyaps3:main" +"tsview.py" = "mintpy.cli.tsview:main" +"unwrap_error_bridging.py" = "mintpy.cli.unwrap_error_bridging:main" +"unwrap_error_phase_closure.py" = "mintpy.cli.unwrap_error_phase_closure:main" +"view.py" = "mintpy.cli.view:main" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +dependencies = { file = ["requirements.txt"] } + +# extra requirements: `pip install pysolid[test]` or `pip install .[test]` +[tool.setuptools.dynamic.optional-dependencies.test] +file = ["tests/requirements.txt"] + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +mintpy = [ + "data/*.js", + "data/*.png", + "data/colormaps/*.cpt", + "defaults/*.cfg", + "defaults/*.yaml", +] + +[tool.setuptools_scm] +version_scheme = "post-release" +local_scheme = "no-local-version" diff --git a/requirements.txt b/requirements.txt index a3b69593e..a50759650 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,20 +1,14 @@ -# requirements.txt for dependency installation via conda -# docs/ports.txt for dependency installation via mac-ports -# setup.py for mintpy installation via pip after the dependency installation above -python>=3.6 pip argcomplete cartopy cvxopt dask>=1.0 dask-jobqueue>=0.3 -# gdal>=3 # for ISCE, ARIA, FRInGE, HyP3, GMTSAR users h5py joblib lxml matplotlib numpy -pre-commit # for developers pyaps3>=0.3 pykml>=0.2 pyproj diff --git a/setup.py b/setup.py deleted file mode 100644 index e869e5c09..000000000 --- a/setup.py +++ /dev/null @@ -1,180 +0,0 @@ -#!/usr/bin/env python -############################################################ -# Program is part of MintPy # -# Copyright (c) 2013, Zhang Yunjun, Heresh Fattahi # -# Author: Zhang Yunjun, Nov 2020 # -############################################################ - -import os -import sys - -# Always prefer setuptools over distutils -from setuptools import find_packages, setup - -# Grab version and description from version.py -# link: https://stackoverflow.com/questions/53648900 -sys.path.append(os.path.join(os.path.dirname(__file__), "src")) -from mintpy.version import description, version - -# Grab long_description from README.md -with open("docs/README.md") as f: - long_description = f.read() - -setup( - name="mintpy", - version=version, - description=description, - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/insarlab/MintPy", - download_url=(f"https://github.com/insarlab/MintPy/archive/v{version}.tar.gz"), - author="Zhang Yunjun, Heresh Fattahi", - author_email="yunjunz@outlook.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="InSAR, deformation, time-series, volcano, earthquake, tectonics, geodesy, geophysics, remote-sensing", - - project_urls={ - "Bug Reports": "https://github.com/insarlab/mintpy/issues", - "Documentation": "https://mintpy.readthedocs.io/", - "Source": "https://github.com/insarlab/mintpy", - }, - - # dependencies - python_requires=">=3.6", - install_requires=[ - "argcomplete", - "cartopy", - "cvxopt", - "dask>=1.0", - "dask-jobqueue>=0.3", - "h5py", - "joblib", - "lxml", - "matplotlib", - "numpy", - "pre-commit", # for developers - "pyaps3>=0.3", - "pykml>=0.2", - "pyproj", - "pyresample", # pip installed version does not work - "pysolid", # pip installed version does not work because Fortran compiler is needed but not available via pip - "rich", - "setuptools", - "scikit-image", - "scipy", - "shapely", - "utm", - ], - extras_require={ - "extra": ["gdal"], - "fractal": ["pyfftw"], - "gbis": ["geoid"], # not available on pypi - "isce": ["isce"], # not available on pypi - "kite": ["kite"], - "all": [ - "extra", - "fractal", - "gbis", - "isce", - "kite", - ], - }, - - # package discovery - packages=find_packages("src"), # include all packages under src - package_dir={"": "src"}, # tell distutils packages are under src - entry_points={ - 'console_scripts': [ - 'mintpy = mintpy.__main__:main', - 'add.py = mintpy.cli.add:main', - 'asc_desc2horz_vert.py = mintpy.cli.asc_desc2horz_vert:main', - 'closure_phase_bias.py = mintpy.cli.closure_phase_bias:main', - 'dem_error.py = mintpy.cli.dem_error:main', - 'dem_gsi.py = mintpy.cli.dem_gsi:main', - 'diff.py = mintpy.cli.diff:main', - 'generate_mask.py = mintpy.cli.generate_mask:main', - 'geocode.py = mintpy.cli.geocode:main', - 'ifgram_inversion.py = mintpy.cli.ifgram_inversion:main', - 'image_math.py = mintpy.cli.image_math:main', - 'image_stitch.py = mintpy.cli.image_stitch:main', - 'info.py = mintpy.cli.info:main', - 'iono_tec.py = mintpy.cli.iono_tec:main', - 'load_data.py = mintpy.cli.load_data:main', - 'load_gbis.py = mintpy.cli.load_gbis:main', - 'local_oscilator_drift.py = mintpy.cli.local_oscilator_drift:main', - 'lookup_geo2radar.py = mintpy.cli.lookup_geo2radar:main', - 'mask.py = mintpy.cli.mask:main', - 'modify_network.py = mintpy.cli.modify_network:main', - 'multilook.py = mintpy.cli.multilook:main', - 'multi_transect.py = mintpy.multi_transect:main', - 'plate_motion.py = mintpy.cli.plate_motion:main', - 'plot_coherence_matrix.py = mintpy.cli.plot_coherence_matrix:main', - 'plot_network.py = mintpy.cli.plot_network:main', - 'plot_transection.py = mintpy.cli.plot_transection:main', - 'prep_aria.py = mintpy.cli.prep_aria:main', - 'prep_cosicorr.py = mintpy.cli.prep_cosicorr:main', - 'prep_fringe.py = mintpy.cli.prep_fringe:main', - 'prep_gamma.py = mintpy.cli.prep_gamma:main', - 'prep_gmtsar.py = mintpy.cli.prep_gmtsar:main', - 'prep_hyp3.py = mintpy.cli.prep_hyp3:main', - 'prep_isce.py = mintpy.cli.prep_isce:main', - 'prep_nisar.py = mintpy.cli.prep_nisar:main', - 'prep_roipac.py = mintpy.cli.prep_roipac:main', - 'prep_snap.py = mintpy.cli.prep_snap:main', - 'reference_date.py = mintpy.cli.reference_date:main', - 'reference_point.py = mintpy.cli.reference_point:main', - 'remove_hdf5_dset.py = mintpy.cli.remove_hdf5_dset:main', - 'remove_ramp.py = mintpy.cli.remove_ramp:main', - 's1ab_range_bias.py = mintpy.cli.s1ab_range_bias:main', - 'save_gbis.py = mintpy.cli.save_gbis:main', - 'save_gdal.py = mintpy.cli.save_gdal:main', - 'save_gmt.py = mintpy.cli.save_gmt:main', - 'save_hdfeos5.py = mintpy.cli.save_hdfeos5:main', - 'save_kite.py = mintpy.cli.save_kite:main', - 'save_kmz.py = mintpy.cli.save_kmz:main', - 'save_kmz_timeseries.py = mintpy.cli.save_kmz_timeseries:main', - 'save_qgis.py = mintpy.cli.save_qgis:main', - 'save_roipac.py = mintpy.cli.save_roipac:main', - 'smallbaselineApp.py = mintpy.cli.smallbaselineApp:main', - 'solid_earth_tides.py = mintpy.cli.solid_earth_tides:main', - 'spatial_average.py = mintpy.cli.spatial_average:main', - 'spatial_filter.py = mintpy.cli.spatial_filter:main', - 'subset.py = mintpy.cli.subset:main', - 'temporal_average.py = mintpy.cli.temporal_average:main', - 'temporal_derivative.py = mintpy.cli.temporal_derivative:main', - 'temporal_filter.py = mintpy.cli.temporal_filter:main', - 'timeseries2velocity.py = mintpy.cli.timeseries2velocity:main', - 'timeseries_rms.py = mintpy.cli.timeseries_rms:main', - 'tropo_gacos.py = mintpy.cli.tropo_gacos:main', - 'tropo_phase_elevation.py = mintpy.cli.tropo_phase_elevation:main', - 'tropo_pyaps3.py = mintpy.cli.tropo_pyaps3:main', - 'tsview.py = mintpy.cli.tsview:main', - 'unwrap_error_bridging.py = mintpy.cli.unwrap_error_bridging:main', - 'unwrap_error_phase_closure.py = mintpy.cli.unwrap_error_phase_closure:main', - 'view.py = mintpy.cli.view:main', - ] - }, - - # data files - include_package_data=True, - package_data={ - "mintpy": [ - "data/*.js", - "data/*.png", - "data/colormaps/*.cpt", - "defaults/*.cfg", - "defaults/*.yaml", - ], - }, - zip_safe=False, -) diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 000000000..ef749423f --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,5 @@ +gdal>=3 # for ISCE-2/3, ARIA, FRInGE, HyP3, GMTSAR users +isce2 # for ISCE-2 users +pre-commit # for developers +pyfftw +setuptools_scm