From aea51b43f68435878f8251ee3780e84674af3034 Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Fri, 26 Nov 2021 16:34:02 -0800 Subject: [PATCH] add version.py and badges in README + add version.py for a explicit list of release history + setup.py: grab version number from version.py, instead of manual change + README: add badges, to be consistent with other insarlab repos --- README.md | 6 ++++++ setup.py | 9 ++++++++- src/pyaps3/version.py | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/pyaps3/version.py diff --git a/README.md b/README.md index b8c282e..544b98b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +[![Language](https://img.shields.io/badge/python-3.6%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/badge/version-v0.3.1-green.svg)](https://github.com/insarlab/PyAPS/releases) +[![License](https://img.shields.io/badge/license-GPLv3-yellow.svg)](https://github.com/insarlab/PyAPS/blob/main/LICENSE) +[![Citation](https://img.shields.io/badge/doi-10.1029%2F2011GL048757-blue)](https://doi.org/10.1029/2011GL048757) + ## PyAPS - Python based Atmospheric Phase Screen estimation This python 3 module estimates differential phase delay maps due to the stratified atmosphere for correcting radar interferograms. It is rewritten in Python 3 language from PYAPS source code and adapted for ECMWF's ERA-5 corrections. diff --git a/setup.py b/setup.py index 65b8630..d7b5b7d 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,13 @@ 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() @@ -11,7 +18,7 @@ setup( name='pyaps3', - version='0.3.0', + version=version, description="Python based Atmospheric Phase Screen Estimation", long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/pyaps3/version.py b/src/pyaps3/version.py new file mode 100644 index 0000000..01e6c73 --- /dev/null +++ b/src/pyaps3/version.py @@ -0,0 +1,20 @@ +#!/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.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 +