diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4c505d1..1f5df85 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -19,34 +19,70 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] # Add more os? - python-version: [3.7, 3.8] - astropy-version: ['<4.1', '<5.0'] - numpy-version: ['<1.20', '<1.21'] - scipy-version: ['<1.5', '<1.6'] + python-version: [3.8, 3.9] + astropy-version: ['<5.0', '<5.1'] + numpy-version: ['<1.20', '<1.21', '<1.22'] + scipy-version: ['<1.6', '<1.7'] + matplotlib-version: ['<3.4', '<3.5'] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install Python dependencies run: | - python -m pip install --upgrade pip wheel - python -m pip install pytest pytest-astropy pyyaml matplotlib\<3.3 + python -m pip install --upgrade pip wheel setuptools + python -m pip install pytest pytest-astropy pyyaml # python -m pip install -r requirements.txt - python -m pip install 'numpy${{ matrix.numpy-version }}' - python -m pip install 'astropy${{ matrix.astropy-version }}' python -m pip install 'scipy${{ matrix.scipy-version }}' + python -m pip install 'matplotlib${{ matrix.matplotlib-version }}' + python -m pip install 'astropy${{ matrix.astropy-version }}' + python -m pip install 'numpy${{ matrix.numpy-version }}' - name: Run the test run: pytest - - + + coverage: + name: Test coverage + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: [3.8] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip wheel setuptools + python -m pip install pytest pytest-astropy coveralls + python -m pip install pyyaml numpy\<1.21 scipy\<1.6 matplotlib\<3.3 astropy\<5.0 + + - name: Run the test with coverage + run: pytest --cov + + - name: Coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: coveralls + docs: name: Doc test runs-on: ${{ matrix.os }} @@ -54,24 +90,53 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: [3.8] + python-version: [3.9] + steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - + - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - + - name: Install Python dependencies run: | - python -m pip install --upgrade pip wheel docutils\<0.18 Sphinx + python -m pip install --upgrade pip wheel setuptools docutils\<0.18 Sphinx python -m pip install sphinx-astropy python -m pip install speclite - + - name: Test the documentation run: sphinx-build -W --keep-going -b html docs docs/_build/html - + + style: + name: Style test + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: [3.9] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip wheel setuptools flake8 + + - name: Test the style; failures are allowed + # This is equivalent to an allowed falure. + continue-on-error: true + run: flake8 speclite --count --max-line-length=100 diff --git a/CHANGES.rst b/CHANGES.rst deleted file mode 100644 index b39caa1..0000000 --- a/CHANGES.rst +++ /dev/null @@ -1,100 +0,0 @@ -0.17 (unreleased) ------------------ - - - Add 2MASS JHKs filter curves. - -0.16 (2022-07-19) ------------------ - -- Add new SDSS filters which include atmospheric extinction (airmass=1.3). - -0.15 (2022-01-10) ------------------ - - - Fix documentation builds. - -0.14 (2021-09-09) ------------------ - -- Update SDSS filter metadata to reflect that no atmospheric extinction is included. - -0.13 (2021-01-18) ------------------ - -- Add GAIA DR2 filter curves. - -0.12 (2021-01-15) ------------------ - -- Add DECam DR1 filter curves with and without X=1.2 atmosphere. - -0.11 (2020-11-23) ------------------ - -- Another attempt to fix broken astropy_helpers in pypi release. - -0.10 (2020-11-23) ------------------ - -- Fix broken 0.9 pypi release. - -0.9 (2020-07-31) ----------------- - -- Minor updates for py3.8 support (#55) -- fix installation problems (#56) - -0.8 (2018-09-11) ----------------- - -- Add MzLS-z, BASS-g, BASS-r filters used by DESI imaging surveys. -- Update astropy-helpers to v2.0.6. - -0.7 (2017-10-03) ----------------- - -- Update to astropy_helpers v2.0.1 (#32). - -0.6 (2017-10-02) ----------------- - -- Remove tests against python 3.3 and numpy 1.7. -- Add HSC filters (#31). -- Save filter curves at full machine precision (#27). -- Update to latest astropy affiliate package template. -- Add support and travis testing for python 3.6. -- Add support for band shifted filters (#20). -- Clean up package-level imports (#23). - -0.5 (2016-08-22) ----------------- - -- Update to latest astropy affiliate package template. -- Drop support for python 2.6 and add support for python 3.5. -- Add testing against LTS release of astropy. -- Drop testing against numpy 1.6 and add numpy 1.11. -- Update readthedocs URLs (.org -> .io). -- Add LSST filter response curves. - -0.4 (2016-02-17) ----------------- - -- Improve filter module error messages and validation. -- Add mask_invalid option to FilterSequence methods. -- Implement pad_spectrum method of FilterResponse and FilterSequence. - -0.3 (2016-02-05) ----------------- - -- Add filter response curves and filters module. -- Add pyyaml required dependency (for reading filter curves). - -0.2 (2015-11-15) ----------------- - -- Add downsample module. - -0.1 (2015-08-05) ----------------- - -- Initial release. diff --git a/README.rst b/README.rst index 0d248f1..33431a8 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,11 @@ +================ speclite package ================ -.. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat - :target: http://www.astropy.org - :alt: Powered by Astropy Badge +|Astropy| |PyPI| |License| |Actions Status| |Coveralls Status| |Documentation Status| + +Introduction +------------ This package provides a set of lightweight utilities for working with spectroscopic data in astronomy. @@ -11,29 +13,55 @@ This package provides a set of lightweight utilities for working with spectrosco * Documentation: `latest `_ | `stable `_ * Based on the Astropy affiliated package template. +Citation +-------- + +|DOI| + Please cite as: David Kirkby, Andy Park, John Moustakas, Stephen Bailey, Benjamin Alan Weaver, Sergey Koposov, Marcelo Alvarez, Hélion du Mas des Bourboux, & Javier Sanchez. (2023). desihub/speclite: Initial DOI (v0.16). Zenodo. https://doi.org/10.5281/zenodo.7734526 +Requirements +------------ Speclite has the following package requirements: -* `numpy `__ -* `scipy `__ -* `astropy `__ -* `pyyaml `__ +* `NumPy `__ +* `SciPy `__ +* `Astropy `__ +* `PyYAML `__ -.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.7734526.svg - :target: https://doi.org/10.5281/zenodo.7734526 +License +------- -.. image:: https://readthedocs.org/projects/speclite/badge/?version=latest - :target: https://readthedocs.org/projects/speclite/?badge=latest - :alt: Documentation Status +speclite is free software licensed under a 3-clause BSD-style license. For details see +the ``licenses/LICENSE.rst`` file. + +.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.7734526.svg + :target: https://doi.org/10.5281/zenodo.7734526 + :alt: DOI: 10.5281/zenodo.7734526 -.. image:: https://coveralls.io/repos/dkirkby/speclite/badge.svg?branch=master&service=github - :target: https://coveralls.io/github/dkirkby/speclite?branch=master - :alt: Coverage Status +.. |Astropy| image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat + :target: http://www.astropy.org + :alt: Powered by Astropy Badge + +.. |License| image:: https://img.shields.io/pypi/l/speclite.svg + :target: https://pypi.org/project/speclite/ + :alt: BSD License + +.. |Actions Status| image:: https://github.com/desihub/speclite/workflows/CI/badge.svg + :target: https://github.com/desihub/speclite/actions + :alt: GitHub Actions CI Status + +.. |Coveralls Status| image:: https://coveralls.io/repos/desihub/desiutil/badge.svg?branch=main + :target: https://coveralls.io/github/desihub/desiutil?branch=main + :alt: Test Coverage Status + +.. |Documentation Status| image:: https://readthedocs.org/projects/speclite/badge/?version=latest + :target: https://speclite.readthedocs.org/en/latest/ + :alt: Documentation Status -.. image:: https://img.shields.io/pypi/v/speclite.svg - :target: https://pypi.python.org/pypi/speclite +.. |PyPI| image:: https://img.shields.io/pypi/v/speclite.svg + :target: https://pypi.org/project/speclite/ :alt: Distribution Status diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 26e39a2..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,52 +0,0 @@ -# AppVeyor.com is a Continuous Integration service to build and run tests under -# Windows - -environment: - - global: - PYTHON: "C:\\conda" - MINICONDA_VERSION: "latest" - CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd" - PYTHON_ARCH: "64" # needs to be set for CMD_IN_ENV to succeed. If a mix - # of 32 bit and 64 bit builds are needed, move this - # to the matrix section. - - # 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: "scipy pyyaml matplotlib" - - # Conda packages for affiliated packages are hosted in channel - # "astropy" while builds for astropy LTS with recent numpy versions - # are in astropy-ci-extras. If your package uses either of these, - # add the channels to CONDA_CHANNELS along with any other channels - # you want to use. - # CONDA_CHANNELS: "astropy-ci-extras astropy" - - matrix: - - # We test Python 2.7 and 3.6 because 2.7 is the supported Python 2 - # release of Astropy and Python 3.6 is the latest Python 3 release. - - - PYTHON_VERSION: "2.7" - ASTROPY_VERSION: "stable" - NUMPY_VERSION: "stable" - - - PYTHON_VERSION: "3.6" - ASTROPY_VERSION: "stable" - NUMPY_VERSION: "stable" - -platform: - -x64 - -install: - - "git clone git://github.com/astropy/ci-helpers.git" - - "powershell ci-helpers/appveyor/install-miniconda.ps1" - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - "activate test" - -# Not a .NET project, we build the package in the install step instead -build: false - -test_script: - - "%CMD_IN_ENV% python setup.py test" diff --git a/docs/changes.rst b/docs/changes.rst new file mode 100644 index 0000000..83238f8 --- /dev/null +++ b/docs/changes.rst @@ -0,0 +1,133 @@ +=================== +speclite Change Log +=================== + +0.17 (unreleased) +----------------- + +- Add 2MASS JHKs filter curves (PR `#79`_). +- Restore some missing CI tests and other infrastructure updates (PR `#81`_). + +.. _`#79`: https://github.com/desihub/speclite/pull/79 +.. _`#81`: https://github.com/desihub/speclite/pull/81 + +0.16 (2022-07-19) +----------------- + +- Add new SDSS filters which include atmospheric extinction (airmass=1.3) (PR `#76`_). + +.. _`#76`: https://github.com/desihub/speclite/pull/76 + +0.15 (2022-01-10) +----------------- + +- Fix documentation builds and other deprecation warnings (PR `#73`_, `#72`_). + +.. _`#73`: https://github.com/desihub/speclite/pull/73 +.. _`#72`: https://github.com/desihub/speclite/pull/72 + +0.14 (2021-09-09) +----------------- + +- Update SDSS filter metadata to reflect that no atmospheric extinction is included (602e805_). +- Fix deprecated Astropy utilities (PR `#68`_). +- Migrate to GitHub Actions (PR `#65`_). + +.. _602e805: https://github.com/desihub/speclite/commit/602e80562615c11e86429576b2f9b996efe39050 +.. _`#68`: https://github.com/desihub/speclite/pull/68 +.. _`#65`: https://github.com/desihub/speclite/pull/65 + +0.13 (2021-01-18) +----------------- + +- Add GAIA DR2 filter curves (PR `#62`_). + +.. _`#62`: https://github.com/desihub/speclite/pull/62 + +0.12 (2021-01-15) +----------------- + +- Add DECam DR1 filter curves with and without X=1.2 atmosphere (PR `#61`_). + +.. _`#61`: https://github.com/desihub/speclite/pull/61 + +0.11 (2020-11-23) +----------------- + +- Another attempt to fix broken ``astropy_helpers`` in PyPI release. + +0.10 (2020-11-23) +----------------- + +- Fix broken 0.9 PyPI release. + +0.9 (2020-07-31) +---------------- + +- Minor updates for Python 3.8 support (PR `#55`_). +- Fix installation problems (`#56`_). + +.. _`#56`: https://github.com/desihub/speclite/pull/56 +.. _`#55`: https://github.com/desihub/speclite/pull/55 + +0.8 (2018-09-11) +---------------- + +- Add MzLS-z, BASS-g, BASS-r filters used by DESI imaging surveys. +- Update ``astropy_helpers`` to v2.0.6. + +0.7 (2017-10-03) +---------------- + +- Update to ``astropy_helpers`` v2.0.1 (PR `#32`_). + +.. _`#32`: https://github.com/desihub/speclite/pull/32 + +0.6 (2017-10-02) +---------------- + +- Remove tests against Python 3.3 and Numpy 1.7. +- Add HSC filters (PR `#31`_). +- Save filter curves at full machine precision (PR `#27`_). +- Update to latest Astropy affiliate package template. +- Add support and travis testing for Python 3.6. +- Add support for band shifted filters (PR `#20`_). +- Clean up package-level imports (PR `#23`_). + +.. _`#31`: https://github.com/desihub/speclite/pull/31 +.. _`#27`: https://github.com/desihub/speclite/pull/27 +.. _`#23`: https://github.com/desihub/speclite/pull/23 +.. _`#20`: https://github.com/desihub/speclite/pull/20 + +0.5 (2016-08-22) +---------------- + +- Update to latest Astropy affiliate package template. +- Drop support for Python 2.6 and add support for Python 3.5. +- Add testing against LTS release of Astropy. +- Drop testing against Numpy 1.6 and add Numpy 1.11. +- Update ReadTheDocs URLs (.org -> .io). +- Add LSST filter response curves. + +0.4 (2016-02-17) +---------------- + +- Improve filter module error messages and validation. +- Add mask_invalid option to FilterSequence methods. +- Implement pad_spectrum method of FilterResponse and FilterSequence. + +0.3 (2016-02-05) +---------------- + +- Add filter response curves and filters module. +- Add pyyaml required dependency (for reading filter curves). + +0.2 (2015-11-15) +---------------- + +- Add downsample module. + +0.1 (2015-08-05) +---------------- + +- Initial release. diff --git a/docs/index.rst b/docs/index.rst index 3550369..8fd3a6f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,3 +11,4 @@ This package provides a set of lightweight utilities for working with spectrosco install.rst filters.rst api.rst + changes.rst diff --git a/setup.cfg b/setup.cfg index d2216a2..82a6de1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,13 +12,69 @@ all_files = 1 upload-dir = docs/_build/html show-response = 1 +[ah_bootstrap] +auto_use = True + +[metadata] +package_name = speclite +description = Lightweight utilities for working with spectroscopic data +long_description = This package provides a set of lightweight utilities for working with spectroscopic data in astronomy. Based on the astropy affiliated package template. +author = Speclite Developers +author_email = dkirkby@uci.edu +license = BSD +url = https://speclite.readthedocs.io/ +edit_on_github = True +github_project = desihub/speclite +install_requires = astropy scipy pyyaml pytest_astropy_header +# version should be PEP440 compatible, e.g. 0.8 or 0.8dev (http://www.python.org/dev/peps/pep-0440) +version = 0.17.dev + +[options.entry_points] +console_scripts = + speclite_benchmark = speclite.benchmark:main + [tool:pytest] -minversion = 2.2 +testpaths = "speclite" "docs" norecursedirs = build docs/_build +astropy_header = true doctest_plus = enabled +text_file_format = rst +# addopts = --doctest-glob=*.rst +addopts = --doctest-rst -[ah_bootstrap] -auto_use = True +[coverage:run] +relative_files = True +omit = + speclite/_astropy_init* + speclite/conftest.py + speclite/*setup_package* + speclite/tests/* + speclite/*/tests/* + speclite/extern/* + speclite/version* + */speclite/_astropy_init* + */speclite/conftest.py + */speclite/*setup_package* + */speclite/tests/* + */speclite/*/tests/* + */speclite/extern/* + */speclite/version* + +[coverage:report] +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + # Don't complain about packages we have installed + except ImportError + # Don't complain if tests don't hit assertions + raise AssertionError + raise NotImplementedError + # Don't complain about script hooks + def main\(.*\): + # Ignore branches that don't pertain to this version of Python + pragma: py{ignore_python_version} + # Don't complain about IPython completion helper + def _ipython_key_completions_ [pep8] # E101 - mix of tabs and spaces @@ -35,19 +91,5 @@ auto_use = True select = E101,W191,W291,W292,W293,W391,E111,E112,E113,E901,E902 exclude = extern,sphinx,*parsetab.py -[metadata] -package_name = speclite -description = Lightweight utilities for working with spectroscopic data -long_description = This package provides a set of lightweight utilities for working with spectroscopic data in astronomy. Based on the astropy affiliated package template. -author = Speclite Developers -author_email = dkirkby@uci.edu -license = BSD -url = http://speclite.readthedocs.io/ -edit_on_github = True -github_project = desihub/speclite -install_requires = astropy scipy pyyaml pytest_astropy_header -# version should be PEP440 compatible, e.g. 0.8 or 0.8dev (http://www.python.org/dev/peps/pep-0440) -version = 0.17.dev - -[entry_points] -speclite_benchmark = speclite.benchmark:main +[flake8] +select = E101,W191,W291,W292,W293,W391,E111,E112,E113,E901,E902