Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update infrastructure #196

Merged
merged 9 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
19 changes: 17 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -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: []
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
include RELIC-INFO
exclude stwcs/version.py
2 changes: 0 additions & 2 deletions doc/rtd-pip-requirements

This file was deleted.

9 changes: 9 additions & 0 deletions doc/rtd_requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: rtd311

dependencies:
- python=3.11
- numpy
- astropy
- pip
- graphviz
- sphinx_rtd_theme>1.2.0
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand All @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
9 changes: 5 additions & 4 deletions stwcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion stwcs/tests/test_updatewcs.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions stwcs/updatewcs/corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading