Skip to content
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
91 changes: 46 additions & 45 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,51 +48,51 @@ jobs:
run: nox -s build_tests_unit -x -- -vv


documentation_tests:
name: "Build documentation testing on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest

steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: |
3.10
3.11
3.12

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
python -m pip install nox poetry
poetry self add poetry-plugin-export

- name: "Get public IP address of runner"
# Need to handle this for Windows, MacOS, and linux
# Fetch from ipinfo.io/ip and echo it
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "Windows runner IP: $(curl -s https://ipinfo.io/ip)"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
echo "macOS runner IP: $(curl -s https://ipinfo.io/ip)"
else
echo "Linux runner IP: $(curl -s https://ipinfo.io/ip)"
fi

- name: "Run nox"
run: |
# Unit tests
python -m nox -s build_tests_scripts --verbose -x -- -vv
# documentation_tests:
# name: "Build documentation testing on ${{ matrix.os }}"
# runs-on: "${{ matrix.os }}"
#
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-latest
# - macos-latest
#
# steps:
# - name: "Check out the repo"
# uses: "actions/checkout@v4"
#
# - name: "Set up Python"
# uses: "actions/setup-python@v5"
# with:
# python-version: |
# 3.10
# 3.11
# 3.12
#
# - name: "Install dependencies"
# run: |
# python -m pip install --upgrade pip
# python -m pip install nox poetry
# poetry self add poetry-plugin-export
#
# - name: "Get public IP address of runner"
# # Need to handle this for Windows, MacOS, and linux
# # Fetch from ipinfo.io/ip and echo it
# run: |
# if [[ "$RUNNER_OS" == "Windows" ]]; then
# echo "Windows runner IP: $(curl -s https://ipinfo.io/ip)"
# elif [[ "$RUNNER_OS" == "macOS" ]]; then
# echo "macOS runner IP: $(curl -s https://ipinfo.io/ip)"
# else
# echo "Linux runner IP: $(curl -s https://ipinfo.io/ip)"
# fi
#
# - name: "Run nox"
# run: |
# # Unit tests
# python -m nox -s build_tests_scripts --verbose -x -- -vv


integration_tests:
Expand Down Expand Up @@ -127,6 +127,7 @@ jobs:
with:
python-version: "${{ matrix.python-version }}"
conda-remove-defaults: "true"
channels: conda-forge

- name: "Install and update pip"
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.12
- name: Install dependencies
run: |
pip install --upgrade pip
pip install poetry nox
poetry self add poetry-plugin-export
- name: Install OpenBLAS
run: |
sudo apt-get update
sudo apt-get install -y libopenblas-dev liblapack-dev
- name: Sphinx build
run: |
nox -s docs
Expand Down
102 changes: 51 additions & 51 deletions .github/workflows/source_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,57 +68,57 @@ jobs:
name: covdata
path: .coverage.*

documentation_tests:
name: "Documentation testing on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest

steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: |
3.10
3.11
3.12

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
python -m pip install nox poetry
poetry self add poetry-plugin-export

- name: "Get public IP address of runner"
# Need to handle this for Windows, MacOS, and linux
# Fetch from ipinfo.io/ip and echo it
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "Windows runner IP: $(curl -s https://ipinfo.io/ip)"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
echo "macOS runner IP: $(curl -s https://ipinfo.io/ip)"
else
echo "Linux runner IP: $(curl -s https://ipinfo.io/ip)"
fi

- name: "Run nox"
run: |
# Unit tests
python -m nox -s script_tests --verbose -x -- -xvv

# - name: "Upload coverage data"
# uses: actions/upload-artifact@v4
# with:
# name: covdata
# path: .coverage.*
# documentation_tests:
# name: "Documentation testing on ${{ matrix.os }}"
# runs-on: "${{ matrix.os }}"
#
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-latest
# - macos-latest
#
# steps:
# - name: "Check out the repo"
# uses: "actions/checkout@v4"
#
# - name: "Set up Python"
# uses: "actions/setup-python@v5"
# with:
# python-version: |
# 3.10
# 3.11
# 3.12
#
# - name: "Install dependencies"
# run: |
# python -m pip install --upgrade pip
# python -m pip install nox poetry
# poetry self add poetry-plugin-export
#
# - name: "Get public IP address of runner"
# # Need to handle this for Windows, MacOS, and linux
# # Fetch from ipinfo.io/ip and echo it
# run: |
# if [[ "$RUNNER_OS" == "Windows" ]]; then
# echo "Windows runner IP: $(curl -s https://ipinfo.io/ip)"
# elif [[ "$RUNNER_OS" == "macOS" ]]; then
# echo "macOS runner IP: $(curl -s https://ipinfo.io/ip)"
# else
# echo "Linux runner IP: $(curl -s https://ipinfo.io/ip)"
# fi
#
# - name: "Run nox"
# run: |
# # Unit tests
# python -m nox -s script_tests --verbose -x -- -xvv
#
# # - name: "Upload coverage data"
# # uses: actions/upload-artifact@v4
# # with:
# # name: covdata
# # path: .coverage.*

integration_tests:
name: "DRAGONS integration testing on ${{ matrix.os }}"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

# vscode
.vscode/
Expand Down
7 changes: 5 additions & 2 deletions astrodata/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ def get_program_observations():
raise NotImplementedError


def expand_file_range(files: str) -> list[str]:
def expand_file_range(files: str, extn="") -> list[str]:
"""Expand a range of files into a list of file names.

Arguments
Expand All @@ -1457,6 +1457,9 @@ def expand_file_range(files: str) -> list[str]:

["N20170614S0201", "N20170614S0202", ..., "N20170614S0205"]

extn : str
Extension to add to the filename. Eg ".fits"

Returns
-------
list[str]
Expand All @@ -1467,7 +1470,7 @@ def expand_file_range(files: str) -> list[str]:
file_prep, start = file_prep[: -len(end)], file_prep[-len(end) :]
start, end = int(start), int(end)
files = [
f"{file_prep}{str(i).zfill(len(str(end)))}"
f"{file_prep}{str(i).zfill(len(str(end)))}{extn}"
for i in range(start, end + 1)
]

Expand Down
64 changes: 61 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,64 @@
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Import sanity check ----------------------------------------------------
# Guard against a stale or duplicate copy of the package being picked up
# from PYTHONPATH (or any other entry on sys.path ahead of the repo itself).
# A stray second copy previously caused a confusing failure deep in
# sphinx.ext.autodoc.importer.get_class_members:
# TypeError: argument of type 'property' is not iterable
# triggered by sphinx_automodapi's custom `type` attrgetter operating on
# the wrong/stale `Section` class. Fail fast and clearly instead.

import os
import sys

_PACKAGE_NAME = "astrodata"
_EXPECTED_REPO_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..") # adjust if conf.py moves
)


def _check_import_path():
"""Verify the package being documented is loaded from this repo.

Raises
------
RuntimeError
If the imported package resolves to a location outside the
expected repository root, which usually means a stray
PYTHONPATH entry (or another sys.path entry) is shadowing the
local checkout with a different copy of the package.
"""
try:
module = __import__(_PACKAGE_NAME)
except ImportError as err:
raise RuntimeError(
f"Could not import '{_PACKAGE_NAME}' while building docs. "
f"Check that it is installed/importable in this environment."
) from err

module_path = os.path.abspath(module.__file__)

if not module_path.startswith(_EXPECTED_REPO_ROOT):
pythonpath = os.environ.get("PYTHONPATH", "<not set>")
raise RuntimeError(
f"'{_PACKAGE_NAME}' was imported from an unexpected location:\n"
f" {module_path}\n"
f"Expected it to be under:\n"
f" {_EXPECTED_REPO_ROOT}\n"
f"This usually means PYTHONPATH (or another sys.path entry) "
f"is pointing at a different checkout.\n"
f" PYTHONPATH = {pythonpath}\n"
f" sys.path = {sys.path}\n"
f"Unset PYTHONPATH or remove the offending entry and retry."
)

_check_import_path()

# --- End of PYTHONPATH check ------------


# The full version, including alpha/beta/rc tags
from astrodata import __version__

Expand All @@ -15,7 +73,7 @@
# -- Project information -----------------------------------------------------

project = "astrodata"
copyright = "2023-present, NOIRLab/Gemini Observatories"
copyright = "2026, Association of Universities for Research in Astronomy"
author = "DRAGONS Team"

# -- General configuration ---------------------------------------------------
Expand All @@ -38,7 +96,6 @@
"sphinx_automodapi.smart_resolver",
]


# Run doctest when building the docs
doctest_test_doctest_blocks = "True"
doctest_show_successes = False
Expand Down Expand Up @@ -69,7 +126,8 @@
"astropy": ("http://docs.astropy.org/en/stable/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
# "gemini_instruments": ("https://dragons.readthedocs.io/en/latest/", None),
"DRAGONS": ("https://dragons.readthedocs.io/en/stable/", None),
# "DRAGONS": ("https://dragons.readthedocs.io/en/stable/", None),
"DRAGONS": ("https://dragons.readthedocs.io/en/v4.0.0/", None),
}

intersphinx_disabled_reftypes = ["*"]
Expand Down
Loading
Loading