Skip to content
Open
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
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ on:

jobs:
job:
name: Build
name: Build (${{ matrix.extra }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [
'3.12',
]
extra: [
casa,
pipeline,
]
steps:
- uses: actions/checkout@v7
with:
Expand All @@ -31,6 +35,6 @@ jobs:
python -m pip install --upgrade pip
pip install build
pip install .
pip install .[casa]
pip install ".[${{ matrix.extra }}]"
- name: Build package
run: python -m build
17 changes: 12 additions & 5 deletions phangsPipeline/casaStuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import casashell
import casatasks
import casatools
import casaplotms
from almahelpers_localcopy import tsysspwmap
from casatasks import (
casalog,
Expand Down Expand Up @@ -51,10 +50,22 @@
quanta,
)

# plotms is only needed within the ALMA SD pipeline
try:
import casaplotms
plotms = casaplotms.plotms

except (ImportError, ModuleNotFoundError):
plotms = None
print("Could not import casaplotms")

try:
import casaviewer
viewer = casaviewer.imview

except (ImportError, ModuleNotFoundError):
casaviewer = None
viewer = None
print("Could not import casaviewer")

# TODO: Move back to CASA task
Expand All @@ -79,7 +90,3 @@
tbtool = table
metool = measures
qatool = quanta

plotms = casaplotms.plotms
if casaviewer is not None:
viewer = casaviewer.imview
21 changes: 15 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "phangsPipeline"
dynamic = ["version"]
description = "PHANGS-ALMA Pipeline"
readme = "README.md"
requires-python = ">=3.12, <3.13"
requires-python = ">=3.12"
license = {file = "LICENSE"}

authors = [
Expand Down Expand Up @@ -52,13 +52,22 @@ dependencies = [
[project.optional-dependencies]
casa = [
"casadata >= 2025.9.22",
"casaplotms >= 2.8.2",
"casarecipes >= 0.4.0",
"casashell >= 6.7.3.21, < 6.7.6.14",
"casatasks >= 6.7.3.21, < 6.7.6.14",
"casatools >= 6.7.3.21, < 6.7.6.14",
"casaviewer >= 2.4.4 ; platform_system != 'Darwin'",
"casashell >= 6.7.3.21",
"casatasks >= 6.7.3.21",
"casatools >= 6.7.3.21",
]
pipeline = [
"casaplotms >= 2.8.2", # plotms is only used within the ALMA SD pipeline.
"pipeline@git+https://open-bitbucket.nrao.edu/scm/pipe/pipeline.git",
"phangsPipeline[casa]",
]
viewer = [
"casaviewer >= 2.4.4 ; platform_system != 'Darwin'",
]

all = [
"phangsPipeline[casa,viewer,pipeline]",
]

# Optional packages for the test suite
Expand Down
1 change: 1 addition & 0 deletions pytest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ addopts = [
]
markers = [
"casa: marks tests as requiring CASA install (deselect with '-m \"not casa\"')",
"pipeline: marks tests as requiring the ALMA SD pipeline/plotms install, a superset of casa (deselect with '-m \"not pipeline\"')",
]
testpaths = [
"tests",
Expand Down
10 changes: 1 addition & 9 deletions tests/test_casa_imports.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
import sys
from inspect import getfullargspec

try:
Expand Down Expand Up @@ -32,14 +31,7 @@ class TestCASAImports:

casa_imports = [
"casashell",
"casaplotms",
pytest.param(
"casaviewer",
marks=pytest.mark.xfail(
sys.platform == "darwin",
reason="casaviewer not available on Mac OS X",
),
),
pytest.param("casaplotms", marks=pytest.mark.pipeline),
"casatasks.private.sdint_helper",
]

Expand Down
33 changes: 18 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py3{12}{,-casa}{,-oldestdeps,-cov}
py3{12}{,-casa,-pipeline}{,-oldestdeps,-cov}
lint
docs
requires =
Expand Down Expand Up @@ -38,41 +38,44 @@ allowlist_externals =
description =
run tests
casa: with CASA packages enabled
pipeline: with CASA + pipeline packages enabled
oldestdeps: with the oldest supported dependencies
cov: with coverage
deps =
oldestdeps: minimum_dependencies
extras =
casa: casa
pipeline: pipeline
test
casa: test-casa
casa,pipeline: test-casa
commands =

echo Running on {env:PLATFORM}

# If using CASA, create a temp directory to install data
casa: rm -rf {env:ENVDIR}
casa: mkdir -p {env:ENVDIR}
# If using CASA or the pipeline extra, create a temp directory to install data
casa,pipeline: rm -rf {env:ENVDIR}
casa,pipeline: mkdir -p {env:ENVDIR}

# Move CASA startup files
casa: mkdir -p {env:ENVDIR}{/}.casa
casa: cp {env:CASACONFIGDIR}{/}startup.py {env:ENVDIR}{/}.casa{/}
casa: cp {env:CASACONFIGDIR}{/}config.py {env:ENVDIR}{/}.casa{/}
casa,pipeline: mkdir -p {env:ENVDIR}{/}.casa
casa,pipeline: cp {env:CASACONFIGDIR}{/}startup.py {env:ENVDIR}{/}.casa{/}
casa,pipeline: cp {env:CASACONFIGDIR}{/}config.py {env:ENVDIR}{/}.casa{/}

# Download CASA data
casa: mkdir -p {env:CASADIR}{/}data
casa: python -m casaconfig --update-all
casa: python -m casaconfig --current-data
casa,pipeline: mkdir -p {env:CASADIR}{/}data
casa,pipeline: python -m casaconfig --update-all
casa,pipeline: python -m casaconfig --current-data

# Download and extract the latest analysisUtils
casa: uvx zenodo_get 10.5281/zenodo.7502159 -o {env:ENVDIR}
casa: tar -xf {env:ENVDIR}{/}analysis_scripts.tar -C {env:ENVDIR}{/}
casa,pipeline: uvx zenodo_get 10.5281/zenodo.7502159 -o {env:ENVDIR}
casa,pipeline: tar -xf {env:ENVDIR}{/}analysis_scripts.tar -C {env:ENVDIR}{/}

{list_dependencies_command}

# Run tests
!casa: pytest -m "not casa" \
casa: pytest \
!casa-!pipeline: pytest -m "not casa" \
casa-!pipeline: pytest -m "not pipeline" \
pipeline: pytest \
cov: --cov --cov-branch --cov-report=xml:{env:PLATFORM}-{envname}-coverage.xml \
cov: --junitxml={env:PLATFORM}-{envname}-junit.xml -o junit_family=legacy \
{posargs}
Expand Down
Loading