diff --git a/README.md b/README.md index a6082d4..b505cb5 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,17 @@ 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. + +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=[