diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5b3e9ba..c83850c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,20 +26,20 @@ jobs: python-version: 3.9 toxenv: py39 - - name: Python 3.8 + - name: Python 3.12 runs-on: ubuntu-latest - python-version: 3.8 - toxenv: py38 + python-version: 3.12 + toxenv: py312 - name: Code style checks runs-on: ubuntu-latest - python-version: 3.8 + python-version: 3.11 toxenv: style - - name: Python 3.8 with dev dependencies + - name: Python 3.11 with dev dependencies runs-on: ubuntu-latest - python-version: 3.8 - toxenv: py38-dev + python-version: 3.11 + toxenv: dev steps: - uses: actions/checkout@v2 with: @@ -67,10 +67,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: 3.11 - name: Install tox run: | python -m pip install --upgrade pip diff --git a/.readthedocs.yml b/.readthedocs.yml index 0e8f7817..0b865ca0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,15 +1,30 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required version: 2 sphinx: builder: html configuration: doc/source/conf.py + fail_on_warning: true + +build: + os: ubuntu-22.04 + tools: + python: mambaforge-4.10 + +conda: + environment: doc/rtd_requirements.yaml python: - version: 3.8 - system_packages: true install: - method: pip path: . + extra_requirements: + - doc + # Don't build any extra formats formats: [] diff --git a/MANIFEST.in b/MANIFEST.in index 19a62f2a..cb99df43 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1 @@ -include RELIC-INFO exclude stwcs/version.py diff --git a/doc/rtd-pip-requirements b/doc/rtd-pip-requirements deleted file mode 100644 index e5f235d7..00000000 --- a/doc/rtd-pip-requirements +++ /dev/null @@ -1,2 +0,0 @@ -numpy>=1.11 -astropy diff --git a/doc/rtd_requirements.yaml b/doc/rtd_requirements.yaml new file mode 100644 index 00000000..c1512bc5 --- /dev/null +++ b/doc/rtd_requirements.yaml @@ -0,0 +1,9 @@ +name: rtd311 + +dependencies: + - python=3.11 + - numpy + - astropy + - pip + - graphviz + - sphinx_rtd_theme>1.2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index 6c323d17..9b18616c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,6 +15,7 @@ import importlib # Check Sphinx version import sphinx +import sphinx_rtd_theme # If extensions (or modules to document with autodoc) are in another directory, diff --git a/requirements-dev.txt b/requirements-dev.txt index 37adcf65..6c2f308a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,7 @@ -git+https://github.com/astropy/astropy.git git+https://github.com/spacetelescope/stsci.tools.git + +--extra-index-url https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple astropy --pre + +# Use Bi-weekly numpy/scipy dev builds +--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple +numpy>=0.0.dev0 diff --git a/setup.cfg b/setup.cfg index 29ad9073..c97f4742 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,8 +9,8 @@ edit_on_github = False github_project = spacetelescope/stwcs [tool:pytest] -minversion = 3.6 -norecursedirs = build docs/_build relic +minversion = 3.9 +norecursedirs = build docs/_build filterwarnings= ignore:.*Card is too long* ignore:.*Some non-standard WCS keywords* @@ -22,6 +22,11 @@ filterwarnings= builder = html warning-is-error = 1 +[options.extras_require] +docs = + sphinx + sphinx-rtd-theme + [flake8] # E402, E501, E722 should be added back to the selection list # once they are made to pass. diff --git a/setup.py b/setup.py index 00c47db6..e16656d2 100755 --- a/setup.py +++ b/setup.py @@ -3,11 +3,6 @@ from setuptools import setup, find_packages from configparser import ConfigParser -if sys.version_info < (3, 6): - error = """ - STWCS supports Python 3.6 and above. - """ - sys.exit(error) conf = ConfigParser() conf.read(['setup.cfg']) diff --git a/stwcs/__init__.py b/stwcs/__init__.py index 8e39881f..a2465961 100644 --- a/stwcs/__init__.py +++ b/stwcs/__init__.py @@ -14,18 +14,19 @@ """ import os +import importlib.metadata from . import distortion # noqa from stsci.tools import fileutil # noqa from stsci.tools import teal # noqa -from pkg_resources import get_distribution, DistributionNotFound try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: + __version__ = importlib.metadata.version(__name__) + +except importlib.metadata.PackageNotFoundError: # pragma: no cover # package is not installed - pass + pass # pragma: no cover try: from . import gui diff --git a/stwcs/tests/test_updatewcs.py b/stwcs/tests/test_updatewcs.py index b227e994..c6bc51b4 100644 --- a/stwcs/tests/test_updatewcs.py +++ b/stwcs/tests/test_updatewcs.py @@ -1,8 +1,10 @@ import shutil import os +import warnings from astropy import wcs from astropy.io import fits +from astropy.wcs import FITSFixedWarning from .. import updatewcs from ..updatewcs import apply_corrections from ..distortion import utils as dutils @@ -11,8 +13,9 @@ from numpy import testing import pytest - from . import data + + data_path = os.path.split(os.path.abspath(data.__file__))[0] os.environ['ASTROMETRY_STEP_CONTROL'] = 'Off' @@ -464,6 +467,9 @@ def test_update_stis_asn(): shutil.copyfile(stis_asn_orig_file, fname) shutil.copyfile(idc_orig_file, idctab) + warnings.simplefilter("ignore", category=FITSFixedWarning)#, + # message=" 'datfix' made the change 'Set MJD-OBS to 50853.000000 from DATE-OBS'.") + expnames = updatewcs.updatewcs(fname) assert expnames[0] == os.path.basename(fname_expname1) diff --git a/stwcs/updatewcs/corrections.py b/stwcs/updatewcs/corrections.py index 7dec5686..67349c1f 100644 --- a/stwcs/updatewcs/corrections.py +++ b/stwcs/updatewcs/corrections.py @@ -348,8 +348,8 @@ def updateWCS(cls, ext_wcs, ref_wcs): if n >= m and n >= 2: idcval = np.array([[cx[n, m]], [cy[n, m]]]) sipval = np.dot(imatr, idcval) - akeys1[m, n - m] = sipval[0] - bkeys1[m, n - m] = sipval[1] + akeys1[m, n - m] = sipval[0].item() + bkeys1[m, n - m] = sipval[1].item() Akey = "A_%d_%d" % (m, n - m) Bkey = "B_%d_%d" % (m, n - m) kw2update[Akey] = sipval[0, 0] * ext_wcs.binned, sip_comment diff --git a/tox.ini b/tox.ini index d7dd5a58..e151a5f7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,17 @@ [tox] -envlist= py38, py310, style +envlist= py311, py312, py310, style, dev [testenv] -deps= - dev: -rrequirements-dev.txt + +set_env = + dev: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + +commands_pre = + dev: pip install -r requirements-dev.txt -U --upgrade-strategy eager + extras= test -# astropy will complain if the home directory is missing -passenv= HOME + + commands= pytest