From 0b77e07c3cc34dbd75a9e58776f0db93309f479b Mon Sep 17 00:00:00 2001 From: Eric Koch Date: Wed, 23 Sep 2026 17:05:26 -0700 Subject: [PATCH 1/6] plotms and viewer are always optional --- phangsPipeline/casaStuff.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/phangsPipeline/casaStuff.py b/phangsPipeline/casaStuff.py index ea067159..5dc27185 100644 --- a/phangsPipeline/casaStuff.py +++ b/phangsPipeline/casaStuff.py @@ -2,7 +2,6 @@ import casashell import casatasks import casatools -import casaplotms from almahelpers_localcopy import tsysspwmap from casatasks import ( casalog, @@ -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 @@ -79,7 +90,3 @@ tbtool = table metool = measures qatool = quanta - -plotms = casaplotms.plotms -if casaviewer is not None: - viewer = casaviewer.imview From 935b156023599971a7bcb63a5946fab233e5c00e Mon Sep 17 00:00:00 2001 From: Eric Koch Date: Wed, 23 Sep 2026 17:13:09 -0700 Subject: [PATCH 2/6] Split casa dependencies into groups - pipeline, viewer, all --- pyproject.toml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c8e484de..5d126b08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,14 +52,23 @@ 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'", "pipeline@git+https://open-bitbucket.nrao.edu/scm/pipe/pipeline.git", ] +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", +] +viewer = [ + "casaviewer >= 2.4.4 ; platform_system != 'Darwin'", +] + +all = [ + "phangsPipeline[casa,viewer,pipeline]", +] # Optional packages for the test suite test = [ From 945d9cf25ef4831643d63eaf5e743c48a1e18a77 Mon Sep 17 00:00:00 2001 From: Eric Koch Date: Wed, 23 Sep 2026 17:34:56 -0700 Subject: [PATCH 3/6] pipeline needs the other casa dependencies --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5d126b08..55118fb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,11 +56,11 @@ casa = [ "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", - "pipeline@git+https://open-bitbucket.nrao.edu/scm/pipe/pipeline.git", ] 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'", From 599ce5564ea1b34fbee7c60e159e76eda8a5309b Mon Sep 17 00:00:00 2001 From: Eric Koch Date: Wed, 23 Sep 2026 17:36:01 -0700 Subject: [PATCH 4/6] Split casa/pipeline tox envs and CI matrix to match dependency groups - tox: separate py312-casa/py312-pipeline envs; gate CASA setup on either factor; select pytest markers accordingly - build.yml: matrix over casa/pipeline extras - register pipeline pytest marker for plotms; drop casaviewer test since viewer is no longer installed in CI Co-Authored-By: Claude Sonnet 5 --- .github/workflows/build.yml | 8 ++++++-- pytest.toml | 1 + tests/test_casa_imports.py | 10 +--------- tox.ini | 33 ++++++++++++++++++--------------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ededed6..93574a77 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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 diff --git a/pytest.toml b/pytest.toml index d0bed0e0..2129635f 100644 --- a/pytest.toml +++ b/pytest.toml @@ -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", diff --git a/tests/test_casa_imports.py b/tests/test_casa_imports.py index 3e2c3361..9f08db7d 100644 --- a/tests/test_casa_imports.py +++ b/tests/test_casa_imports.py @@ -1,5 +1,4 @@ import pytest -import sys from inspect import getfullargspec try: @@ -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", ] diff --git a/tox.ini b/tox.ini index 75445157..afeb61cc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py3{12}{,-casa}{,-oldestdeps,-cov} + py3{12}{,-casa,-pipeline}{,-oldestdeps,-cov} lint docs requires = @@ -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} From e7d81bc5f62db4a86079924bd5cb758501e5b8f6 Mon Sep 17 00:00:00 2001 From: Eric Koch Date: Wed, 23 Sep 2026 17:36:35 -0700 Subject: [PATCH 5/6] Drop the 3.12 only. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 55118fb5..44c264fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ From ac823afaefa3abee6a19ada5fd61add6e5de53d6 Mon Sep 17 00:00:00 2001 From: Eric Koch Date: Wed, 23 Sep 2026 22:04:17 -0700 Subject: [PATCH 6/6] Attempt unpinning upper casa limit --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 44c264fa..f9e55d0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,9 +53,9 @@ dependencies = [ casa = [ "casadata >= 2025.9.22", "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", + "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.