From 9d06a1564ae970331625c5277817ecce5385c02e Mon Sep 17 00:00:00 2001 From: Shannon Osborne Date: Thu, 23 Jan 2020 10:45:21 -0500 Subject: [PATCH 1/2] Add versioning doc to README --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index a6082d4..c253d9f 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,15 @@ To get the data from the step by step calculations for the FGS countrate and mag fgs.band_dataframe ``` +Versioning +---------- +This repository follows the principles of ["Semantic Versioning"](https://semver.org/), such that + +> Given a version number MAJOR.MINOR.PATCH, increment the: +> 1. MAJOR version when you make incompatible API changes, +> 2. MINOR version when you add functionality in a backwards compatible manner, and +> 3. PATCH version when you make backwards compatible bug fixes. + License ------- From 8dcb20d90285955ffc1eea96266eab49287b7265 Mon Sep 17 00:00:00 2001 From: Shannon Osborne Date: Thu, 23 Jan 2020 11:50:07 -0500 Subject: [PATCH 2/2] Update version number --- README.md | 2 ++ fgscountrate/__init__.py | 23 +++++++++++++++++------ setup.py | 4 +++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c253d9f..b505cb5 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,8 @@ This repository follows the principles of ["Semantic Versioning"](https://semver > 2. MINOR version when you add functionality in a backwards compatible manner, and > 3. PATCH version when you make backwards compatible bug fixes. +When releasing a new version, developers should change the version number in `setup.py`, merge this change in a PR, and then release the package via the GitHub interface. + License ------- diff --git a/fgscountrate/__init__.py b/fgscountrate/__init__.py index 8c09087..f667cda 100644 --- a/fgscountrate/__init__.py +++ b/fgscountrate/__init__.py @@ -6,17 +6,28 @@ from ._astropy_init import * # ---------------------------------------------------------------------------- +import os import sys -from pkg_resources import get_distribution, DistributionNotFound +import pkg_resources + +module_path = pkg_resources.resource_filename('fgscountrate', '') +setup_path = os.path.normpath(os.path.join(module_path, '../setup.py')) try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: - # package is not installed - __version__ = "unknown" + with open(setup_path) as f: + data = f.readlines() + + for line in data: + if 'VERSION =' in line: + __version__ = line.split(' ')[-1].replace("'", "").strip() + +except FileNotFoundError: + print('Could not determine fgscountrate version') + __version__ = '0.0.0' __minimum_python_version__ = "3.5" + class UnsupportedPythonError(Exception): pass @@ -25,4 +36,4 @@ class UnsupportedPythonError(Exception): from .fgs_countrate_core import * from .utils import * -from .conversions import * \ No newline at end of file +from .conversions import * diff --git a/setup.py b/setup.py index 9281c8b..b15a042 100755 --- a/setup.py +++ b/setup.py @@ -7,6 +7,8 @@ from setuptools import setup, find_packages +VERSION = '1.0.0' + INSTALL_REQUIRES = [ 'numpy', 'pytest', @@ -16,7 +18,7 @@ ] setup(name='fgscountrate', - version='0.0', + version=VERSION, description='JWST FGS countrate estimation', long_description='JWST FGS countrate and magnitude estimation and related functionality.', classifiers=[