Skip to content

Commit

Permalink
Merge pull request #115 from pllim/moar-setup-cfg
Browse files Browse the repository at this point in the history
ENH: Modernize setup and test infrastructure
  • Loading branch information
pllim authored Apr 16, 2020
2 parents 1d6628f + ef13362 commit 9f18e6b
Show file tree
Hide file tree
Showing 30 changed files with 327 additions and 312 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ htmlcov
.coverage
MANIFEST
.ipynb_checkpoints
u40x010hm*.fits

# Sphinx
docs/api
Expand Down Expand Up @@ -46,6 +45,7 @@ develop-eggs
distribute-*.tar.gz
.pytest_cache
.cache
pip-wheel-metadata/

# codecov
.coverage
Expand Down
13 changes: 10 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@

version: 2

sphinx:
builder: html
configuration: doc/source/conf.py
fail_on_warning: true

python:
version: 3.6
version: 3.7
system_packages: true
install:
- requirements: .rtd-environment.yml
- method: setuptools
- method: pip
path: .

# Don't build any extra formats
formats: []
2 changes: 0 additions & 2 deletions .rtd-environment.yml

This file was deleted.

70 changes: 40 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,67 @@
language: python

dist: xenial
language: c

os:
- linux

python:
- 3.7
dist: xenial

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false
# We need a full clone to make sure setuptools_scm works properly
git:
depth: false

env:
global:
# The following versions are the 'default' for tests, unless
# overridden underneath. They are defined here in order to save having
# to repeat them for all configurations.
- PYTHON_VERSION=3.7
- NUMPY_VERSION=stable
- INSTALL_CMD='python setup.py build'
- MAIN_CMD='python setup.py'
- ASTROPY_VERSION=stable
- SETUP_CMD='egg_info'
- INSTALL_CMD="pip install -e .[test]"
- MAIN_CMD="pytest"
- PIP_DEPENDENCIES=''
# For this package-template, we include examples of Cython modules,
# so Cython is required for testing. If your package does not include
# Cython code, you can set CONDA_DEPENDENCIES=''
#- CONDA_DEPENDENCIES='Cython'
- CONDA_DEPENDENCIES='pytest pytest-doctestplus'
- CONDA_DEPENDENCIES=''

matrix:
jobs:
# Don't wait for allowed failures
fast_finish: true

include:
- python: 3.6
env: ASTROPY_VERSION=stable SETUP_CMD="test"
- os: linux

# Try Astropy development version
- python: 3.8
env: ASTROPY_VERSION=development SETUP_CMD="test"
# Older version
- os: linux
env: PYTHON_VERSION=3.6 NUMPY_VERSION=1.16 ASTROPY_VERSION=3.2.3

# PEP8 check
- python: 3.8
env: MAIN_CMD="flake8 --count lib/stsci/tools" SETUP_CMD="" INSTALL_CMD=""
# Try Astropy development version
- os: linux
env: PYTHON_VERSION=3.8 ASTROPY_VERSION=development

# Security audit
- python: 3.8
env: MAIN_CMD="bandit -r . -c .bandit.yaml" SETUP_CMD="" INSTALL_CMD="" PIP_DEPENDENCIES="bandit"
- os: linux
env: PIP_DEPENDENCIES="bandit"
INSTALL_CMD="" MAIN_CMD="bandit -r . -c .bandit.yaml"

# PEP 517
- os: linux
env: PIP_DEPENDENCIES="pep517 twine"
INSTALL_CMD="python -m pep517.build --source ."
MAIN_CMD="twine check dist/*"

# Sphinx linkcheck
- os: linux
env: PIP_DEPENDENCIES="sphinx"
INSTALL_CMD="pip install -e ."
MAIN_CMD="cd doc && make linkcheck"

# PEP8 check
- os: linux
env: INSTALL_CMD="" MAIN_CMD="flake8 --count lib/stsci/tools"

allow_failures:
# PEP8 will fail for numerous reasons. Ignore it.
- python: 3.8
env: MAIN_CMD="flake8 --count lib/stsci/tools" SETUP_CMD="" INSTALL_CMD=""
- os: linux
env: INSTALL_CMD="" MAIN_CMD="flake8 --count lib/stsci/tools"

before_install:

Expand Down Expand Up @@ -91,10 +101,10 @@ install:

script:
- $INSTALL_CMD
- $MAIN_CMD $SETUP_CMD
- $MAIN_CMD

after_success:
# If coveralls.io is set up for this package, uncomment the line
# below and replace "packagename" with the name of your package.
# The coveragerc file may be customized as needed for your package.
#- if [[ $SETUP_CMD == *--coverage* ]]; then coveralls --rcfile='lib/stsci/tools/tests/coveragerc'; fi
#- if [[ $MAIN_CMD == *--coverage* ]]; then coveralls --rcfile='lib/stsci/tools/tests/coveragerc'; fi
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018, Space Telescope Science Institute, AURA
Copyright (c) 2020, Space Telescope Science Institute, AURA
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include CHANGES.rst
include LICENSE.md

include setup.cfg
include pyproject.toml

recursive-include lib/stsci/tools/tests *
recursive-include doc *
Expand Down
32 changes: 26 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
def pytest_report_header(config):
"""Report dependency versions"""
import numpy
import astropy
try:
from pytest_astropy_header.display import (PYTEST_HEADER_MODULES,
TESTED_VERSIONS)
except ImportError:
PYTEST_HEADER_MODULES = {}
TESTED_VERSIONS = {}

return 'numpy: {}\nastropy: {}'.format(
numpy.__version__, astropy.__version__)
try:
from stsci.tools import __version__ as version
except ImportError:
version = 'unknown'

# Uncomment the following line to treat all DeprecationWarnings as
# exceptions
from astropy.tests.helper import enable_deprecations_as_exceptions
enable_deprecations_as_exceptions()

# Uncomment and customize the following lines to add/remove entries
# from the list of packages for which version numbers are displayed
# when running the tests.
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
PYTEST_HEADER_MODULES.pop('Scipy', None)
PYTEST_HEADER_MODULES.pop('Matplotlib', None)
PYTEST_HEADER_MODULES.pop('Pandas', None)
PYTEST_HEADER_MODULES.pop('h5py', None)

TESTED_VERSIONS['stsci.tools'] = version
26 changes: 6 additions & 20 deletions doc/source/analysis.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
**********************
Data Analysis Routines
**********************
======================

These modules provide basic data analysis or data fitting functionality.

linefit
=======
.. automodule:: stsci.tools.linefit
:members:
-------

nmpfit
======
.. automodule:: stsci.tools.nmpfit
.. automodule:: stsci.tools.linefit
:members:

xyinterp
========
.. automodule:: stsci.tools.xyinterp
:members:
--------

gfit
====
.. automodule:: stsci.tools.gfit
.. automodule:: stsci.tools.xyinterp
:members:

Image Combination Modules
*************************

The ``stsci.image.numcombine`` module serves as a limited replacement for
IRAF's 'imcombine' task.
18 changes: 9 additions & 9 deletions doc/source/basicutils.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
************************
General Python Utilities
************************
The modules and functions described here provide support for many of the most general operations used through out STScI_Python.
========================

The modules and functions described here provide support for many of the most general operations used through out STScI_Python.

.. automodule:: stsci.tools.fileutil
:members:
Expand All @@ -10,17 +10,17 @@ The modules and functions described here provide support for many of the most ge
.. automodule:: stsci.tools.parseinput
:members:
:undoc-members:

.. automodule:: stsci.tools.irafglob
:members:
:undoc-members:


STScI_Python Help Support
*************************
The `versioninfo` module reports the version information for a defined set of packages installed as part of STScI_Python which can be sent in as part of a help call. This information can then be used to help identify what software has been installed so that the source of the reported problem can be more easily identified.

-------------------------

The ``versioninfo`` module reports the version information for a defined set of packages installed as part of STScI_Python which can be sent in as part of a help call. This information can then be used to help identify what software has been installed so that the source of the reported problem can be more easily identified.

.. automodule:: stsci.tools.versioninfo
:members:
:undoc-members:

5 changes: 2 additions & 3 deletions doc/source/bitmask.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*********************************************************
Utility functions for handling bit masks and mask arrays.
*********************************************************
Utility functions for handling bit masks and mask arrays
========================================================

.. moduleauthor:: Mihai Cara

Expand Down
17 changes: 9 additions & 8 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@

# General information about the project.
project = u'stsci.tools'
copyright = u'2018, STScI'
copyright = u'2020, STScI'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = __version__
# The full version, including alpha/beta/rc tags.
release = __version__
# The short X.Y version.
version = '.'.join(release.split('.')[:2])

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -200,9 +200,10 @@
#latex_use_modindex = True

intersphinx_mapping = {
'python': ('http://docs.python.org/3', None),
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None),
'matplotlib': ('http://matplotlib.sourceforge.net/', None),
'astropy': ('http://docs.astropy.org/en/stable/', None)
'python': ('https://docs.python.org/3', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
'matplotlib': ('https://matplotlib.org/',
(None, 'http://data.astropy.org/intersphinx/matplotlib.inv')),
'astropy': ('https://docs.astropy.org/en/stable/', None)
}
9 changes: 4 additions & 5 deletions doc/source/fitsutil.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
********************
FITS/Image Utilities
********************
These modules provide support for working with FITS images, WCS information, or conversion of images to FITS format.
====================

These modules provide support for working with FITS images, WCS information, or conversion of images to FITS format.

.. toctree::
:maxdepth: 3

stpyfits
fitsdiff
wcsutil
convert
asnutil

10 changes: 5 additions & 5 deletions doc/source/imgutils.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
********************
Image Access Modules
********************
These modules all provide the capability to access sections of a FITS image
using a scrolling buffer.

====================

These modules all provide the capability to access sections of a FITS image
using a scrolling buffer.

.. automodule:: stsci.tools.iterfile
:members:
10 changes: 2 additions & 8 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
***************************************
Welcome to stsci.tools's documentation!
=======================================
***************************************

The STSCI.TOOLS package in STScI_Python provides many functions for use by multiple software packages.

Expand All @@ -18,18 +19,11 @@ Contents:
imgutils
analysis
bitmask

Building a TEAL Interface for Tasks
-----------------------------------
.. toctree::

teal_guide


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

Loading

0 comments on commit 9f18e6b

Please sign in to comment.