diff --git a/.travis.yml b/.travis.yml index 2f642c56..38b08110 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,10 +21,10 @@ addons: env: global: # https://docs.travis-ci.com/user/environment-variables/ - - NUMPY=1.14 + - NUMPY=1.17 - ASTROPY=4.0 - PYTHON=3.7 - - CONDA_DEPENDENCIES='scipy matplotlib ipython Cython setuptools_scm pip pytest' + - CONDA_DEPENDENCIES='scipy matplotlib pyqt ginga ipython Cython setuptools_scm pip pytest' # PEP8 errors/warnings: # E101 - mix of tabs and spaces @@ -40,7 +40,7 @@ env: # E722 - do not use bare except # E901 - SyntaxError or IndentationError # E902 - IOError - - FLAKE8_OPT="--select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E502,E722,E901,E902" + - FLAKE8_OPT="--select=E101,W191,W291,W292,W293,E111,E112,E113,E502,E722,E901,E902" before_install: # Install the latest version of Miniconda @@ -49,30 +49,25 @@ before_install: - chmod +x miniconda3.sh - ./miniconda3.sh -b - export PATH=/home/travis/miniconda3/bin:$PATH + - conda config --add channels conda-forge + - conda config --add channels astropy - python --version + - git submodule update --init --recursive install: - # You can add any CONDA channels you may need here. CONDA supports - # both the commands add and append. The only difference is that - # the add command places the channel at the front of the priority - # list, while append does the opposite. - - conda config --add channels conda-forge - - conda config --add channels astropy - - conda create --yes -n test python=$PYTHON + - conda create --yes -n test python=$PYTHON numpy=$NUMPY - source activate test - - conda install -y numpy=$NUMPY astropy=$ASTROPY + - conda install -y astropy=$ASTROPY - conda install -y $CONDA_DEPENDENCIES - # - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules - - git submodule update --init --recursive - pip install pytest-pep8 - pip install pytest-cov - pip install coveralls - pip install sphinx-automodapi - pip install photutils + - pip install flake8 - pip install sphinx-astropy - pip install graphviz - - pip install -e . - + - python setup.py build_ext --inplace jobs: @@ -82,21 +77,24 @@ jobs: include: # Check for sphinx doc build warnings - we do this first because - python: 3.7 - script: python setup.py build_sphinx -w + env: numpy=1.17 + script: python setup.py build_sphinx # Try older numpy versions - python: 3.6 - env: numpy=1.14 + env: numpy=1.15 astropy=3.2.3 - python: 3.6 - env: numpy=1.15 - - python: 3.7 - env: numpy=1.14 + env: numpy=1.16 + - python: 3.6 + env: numpy=1.17 - python: 3.7 - env: numpy=1.15 + env: numpy=1.18 - python: 3.7 - env: astropy=3.2.3 numpy=1.15 + env: numpy=1.17 + - python: 3.8 + env: numpy=1.17 - python: 3.8 - env: astropy=4.0 numpy=1.18 + env: numpy=1.18 # Do coverage tests diff --git a/docs/conf.py b/docs/conf.py index 03f84417..de92ff98 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,7 +17,7 @@ import sphinx import sphinx.environment from docutils.utils import get_source_line -from pkg_resources import get_distribution +# from pkg_resources import get_distribution from distutils.version import LooseVersion try: @@ -25,8 +25,12 @@ except ImportError: from configparser import ConfigParser conf = ConfigParser() +conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')]) +setup_cfg = dict(conf.items('metadata')) + +from pkg_resources import get_distribution +release = get_distribution(setup_cfg['package_name']).version -release = get_distribution('imexam').version # for example take major/minor version = '.'.join(release.split('.')[:4]) diff --git a/docs/rtd-pip-requirements b/docs/rtd-pip-requirements index a8bac91f..d1f5e3f0 100644 --- a/docs/rtd-pip-requirements +++ b/docs/rtd-pip-requirements @@ -1,4 +1,5 @@ astropy +scipy numpy matplotlib Cython @@ -7,3 +8,4 @@ ipython astropy-sphinx-theme pytest-astropy sphinx-astropy +sphinx-automodapi diff --git a/imexam/imexamine.py b/imexam/imexamine.py index 3b24bb06..1f3003ab 100644 --- a/imexam/imexamine.py +++ b/imexam/imexamine.py @@ -194,7 +194,7 @@ def do_option(self, x, y, key): """ self.log.debug(f"pressed: {key}, {self.imexam_option_funcs[key][0].__name__}") - # dont require input for saving the active figure + # dont require input for saving the active figure if key == 's': self.imexam_option_funcs[key][0]() else: @@ -542,7 +542,7 @@ def aper_phot(self, x, y, data=None, If error is not None, then it should be given the error array for the corresponding data image. error is assumed to include all sources of error, - including the Poisson error of the sources + including the Poisson error of the sources See the docs for photutils for more details. The returned table will include a 'aperture_sum_err' column in addition to 'aperture_sum'. 'aperture_sum_err' @@ -917,8 +917,8 @@ def column_fit(self, x, y, data=None, form=None, genplot=True, fig=None): return result def com_center(self, x, y, data=None, delta=None, oversample=1.): - """ Return the center of mass of the object at x,y - + """ Return the center of mass of the object at x,y + Parameters ---------- x: int @@ -959,7 +959,7 @@ def com_center(self, x, y, data=None, delta=None, oversample=1.): try: xcenter, ycenter = centroid_com(chunk, oversample=oversample) - pstr = f"xc={(xcenter + xx - delta):.4f}\tyc={(ycenter + yy - delta):.4f}" + pstr = f"xc={(xcenter + xx - delta):.4f}\tyc={(ycenter + yy - delta):.4f}" except AttributeError: raise AttributeError("Problem with center of mass") self.log.info(pstr) diff --git a/imexam/util.py b/imexam/util.py index e166068e..5d137f91 100644 --- a/imexam/util.py +++ b/imexam/util.py @@ -8,11 +8,11 @@ from . import __version__ -try: +try: import imexamxpa as xpa - _have_xpa = True -except ImportError: - _have_xpa = False + _have_xpa = True +except ImportError: + _have_xpa = False # To guide any import * diff --git a/setup.cfg b/setup.cfg index 00348cef..413bd970 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,9 +19,6 @@ classifiers = 'Programming Language :: C' 'Programming Language :: Cython' 'Programming Language :: Python :: 3' - 'Programming Language :: Python :: 3.6' - 'Programming Language :: Python :: 3.7' - 'Programming Language :: Python :: 3.8' 'Programming Language :: Python :: Implementation :: CPython' 'Topic :: Scientific/Engineering :: Astronomy' 'Topic :: Software Development :: Libraries :: Python Modules' @@ -35,7 +32,7 @@ packages = imexam install_requires = numpy>=1.14 - scipy + scipy>=0.18 astropy>=3.0 matplotlib zip_safe = false diff --git a/setup.py b/setup.py index 82992f60..a6443374 100644 --- a/setup.py +++ b/setup.py @@ -65,9 +65,11 @@ def finalize_options(self): BuildDoc.finalize_options(self) def run(self): - build_cmd = self.reinitialize_command('build_ext') - build_cmd.inplace = 1 - self.run_command('build_ext') + try: + import imexam + except ImportError as e: + build_cmd = self.reinitialize_command('build_ext') + build_cmd.inplace = 1 retcode = build_main(['-W', '--keep-going', '-b', 'html', './docs', './docs/_build/html']) if retcode != 0: sys.exit(retcode) @@ -192,7 +194,8 @@ def finalize_options(self): def run(self): try: - check_call(["make", "clean"], cwd=XPALIB_DIR) + if os.access(XPALIB_DIR + "Makefile", os.F_OK): + check_call(["make", "clean"], cwd=XPALIB_DIR) except CalledProcessError as e: print(e) exit(1) @@ -240,9 +243,7 @@ def run(self): if self.remake: try: check_call(["sh", "./configure","--prefix="+current_env], cwd=XPALIB_DIR) - check_call(["make", "-f", "Makefile", "clean"], - cwd=XPALIB_DIR) - check_call(["make", "-f", "Makefile", "install"], cwd=XPALIB_DIR) + check_call(["make", "install"], cwd=XPALIB_DIR) except CalledProcessError as e: print(e) exit(1) @@ -267,9 +268,9 @@ def build_extensions(self): def run(self): try: - check_call(["make", "-f", "Makefile", "clean"],cwd=XPALIB_DIR) check_call(["sh", "./configure","--prefix="+current_env], cwd=XPALIB_DIR) - check_call(["make", "-f", "Makefile", "install"], cwd=XPALIB_DIR) + check_call(["make", "clean"],cwd=XPALIB_DIR) + check_call(["make", "install"], cwd=XPALIB_DIR) except CalledProcessError as e: print(e) exit(1)