Repository: conda-forge/staged-recipes
Pull request #29762: Add `casatools` and `casatasks`, pieces of the CASA suite
Author: login: pkgw
Labels: name: review-requested
name: python-c
Created: 2025-04-17T20:08:17Z | Merged: 2025-04-28T12:27:33Z

CASA is a radio astronomical data processing package.

<!--
Thank you very much for putting in this recipe PR!

This repository is very active, so if you need help with a PR, please let the
right people know. There are language-specific teams for reviewing recipes.

| Language        | Name of review team           |
| --------------- | ----------------------------- |
| python          | `@conda-forge/help-python`    |
| python/c hybrid | `@conda-forge/help-python-c`  |
| r               | `@conda-forge/help-r`         |
| java            | `@conda-forge/help-java`      |
| nodejs          | `@conda-forge/help-nodejs`    |
| c/c++           | `@conda-forge/help-c-cpp`     |
| perl            | `@conda-forge/help-perl`      |
| Julia           | `@conda-forge/help-julia`     |
| ruby            | `@conda-forge/help-ruby`      |
| Rust            | `@conda-forge/help-rust`      |
| Go              | `@conda-forge/help-go`        |
| other           | `@conda-forge/staged-recipes` |

Once the PR is ready for review, please mention one of the teams above in a
new comment. i.e. `@conda-forge/help-some-language, ready for review!`
Then, a bot will label the PR as 'review-requested'.

Due to GitHub limitations, first time contributors to conda-forge are unable
to ping conda-forge teams directly, but you can [ask a bot to ping the team][1]
using a special command in a comment on the PR to get the attention of the
`staged-recipes` team. You can also consider asking on our [Zulip chat][2]
if your recipe isn't reviewed promptly.

[1]: https://conda-forge.org/docs/maintainer/infrastructure.html#conda-forge-admin-please-ping-team
[2]: https://conda-forge.zulipchat.com

All apologies in advance if your recipe PR does not receive prompt attention.
This is a high volume repository and the reviewers are volunteers. Review times
vary depending on the number of reviewers on a given language team and may be days
or weeks. We are always looking for more staged-recipe reviewers. If you are
interested in volunteering, please contact a member of @conda-forge/core.
We'd love to have the help!
-->

Checklist
- [x] Title of this PR is meaningful: e.g. "Adding my_nifty_package", not "updated meta.yaml".
- [x] License file is packaged (see [here](https://github.com/conda-forge/staged-recipes/blob/5eddbd7fc9d1502169089da06c3688d9759be978/recipes/example/meta.yaml#L64-L73) for an example).
- [x] Source is from official source.
- [x] Package does not vendor other packages. (If a package uses the source of another package, they should be separate packages or the licenses of all packages need to be packaged).
- [x] If static libraries are linked in, the license of the static library is packaged.
- [x] Package does not ship static libraries. If static libraries are needed, [follow CFEP-18](https://github.com/conda-forge/cfep/blob/main/cfep-18.md).
- [x] Build number is 0.
- [x] A tarball (`url`) rather than a repo (e.g. `git_url`) is used in your recipe (see [here](https://conda-forge.org/docs/maintainer/adding_pkgs.html#build-from-tarballs-not-repos) for more details).
- [x] GitHub users listed in the maintainer section have posted a comment confirming they are willing to be listed there.
- [x] When in trouble, please check our [knowledge base documentation](https://conda-forge.org/docs/maintainer/knowledge_base.html) before pinging a team.



Diff:
diff --git a/recipes/casatasks/build.sh b/recipes/casatasks/build.sh
new file mode 100644
index 0000000000000..1023f439a01cb
--- /dev/null
+++ b/recipes/casatasks/build.sh
@@ -0,0 +1,9 @@
+#! /bin/bash
+
+set -xeuo pipefail
+cd casatasks
+python ./setup.py build
+python ./setup.py install --single-version-externally-managed --root=$PREFIX
+
+# The ~gigabyte CASA data tree gets populated during the build, so:
+rm -rf $PREFIX/share/casa/data
diff --git a/recipes/casatasks/meta.yaml b/recipes/casatasks/meta.yaml
new file mode 100644
index 0000000000000..5e4303d9ef371
--- /dev/null
+++ b/recipes/casatasks/meta.yaml
@@ -0,0 +1,65 @@
+{% set version = "6.7.2.12" %}
+
+package:
+  name: casatasks
+  version: {{ version }}
+
+source:
+  fn: casa-{{ version }}.tar.gz
+  url: https://open-bitbucket.nrao.edu/rest/api/latest/projects/CASA/repos/casa6/archive?at=refs%2Ftags%2F{{ version }}&format=tgz
+  sha256: 056511bfe4b662e8f4972a7ba3232eb71c8ecedcee2a7db47ceeda2ec1fd8c0a
+  patches:
+    - versioning.patch
+
+build:
+  number: 0
+  noarch: python
+
+requirements:
+  build:
+    - openjdk
+  host:
+    - casatools {{ version }}
+    - certifi
+    - matplotlib-base
+    - pip
+    - pyerfa
+    - python {{ python_min }}
+    - scipy
+    - setuptools
+  run:
+    - casatools {{ version }}
+    - certifi
+    - matplotlib-base
+    - pyerfa
+    - python >={{ python_min }}
+    - scipy
+    - setuptools
+
+test:
+  requires:
+    - python {{ python_min }}
+  imports:
+    - casatasks
+    # A grab-bag of some of the task modules ...
+    - casatasks.asdmsummary
+    - casatasks.deconvolve
+    - casatasks.flagdata
+    - casatasks.hanningsmooth
+    - casatasks.impbcor
+    - casatasks.importvla
+    - casatasks.plotweather
+    - casatasks.rerefant
+    - casatasks.sdintimaging
+    - casatasks.smoothcal
+    - casatasks.vishead
+
+about:
+  home: http://casa.nrao.edu/
+  license: LGPL-2.1-or-later
+  license_file: casatasks/src/LICENSE.txt
+  summary: "Task implementations for CASA, the radio astronomical data processing package"
+
+extra:
+  recipe-maintainers:
+    - pkgw
diff --git a/recipes/casatasks/versioning.patch b/recipes/casatasks/versioning.patch
new file mode 100644
index 0000000000000..f565ab85a4532
--- /dev/null
+++ b/recipes/casatasks/versioning.patch
@@ -0,0 +1,39 @@
+diff --git a/casatasks/setup.py b/casatasks/setup.py
+index 9932d52432..9b88ea33a1 100755
+--- a/casatasks/setup.py
++++ b/casatasks/setup.py
+@@ -89,13 +89,6 @@ from os.path import isfile, join, islink
+ from itertools import chain
+ import argparse
+
+-parser=argparse.ArgumentParser()
+-parser.add_argument('--version', help='version')
+-parser.add_argument('bdist_wheel', help='bdist_wheel')
+-args=parser.parse_args()
+-
+-print (args.version)
+-
+ module_name = 'casatasks'
+
+ pyversion = ".".join(tuple(str(x) for x in sys.version_info[0:2]))
+@@ -113,9 +106,8 @@ def pipe_decode(output):
+         return ("","")
+
+ def compute_version( ):
+-    if (args.version != None ):
+-        print (args.version.split("."))
+-        (major, minor, patch, feature) = args.version.split(".")
++    if True:
++        (major, minor, patch, feature) = os.environ["PKG_VERSION"].split(".")
+         return(int(major), int(minor), int(patch), int(feature),"","","")
+     else:
+         proc = Popen( [ "./version" ], stdout=PIPE, stderr=PIPE )
+@@ -451,7 +443,7 @@ class BuildCasa(build):
+         for x in xml_files:
+             copy2(x,xmldir)
+
+-        os.makedirs(os.path.join(moduledir, 'tests'))
++        os.makedirs(os.path.join(moduledir, 'tests'), exist_ok=True)
+         f = open("{}/__init__.py".format(os.path.join(moduledir, 'tests')), "w")
+         f.close()
+         copy2('tests/test_casatasks.py',os.path.join(moduledir, 'tests'))
diff --git a/recipes/casatools/build.sh b/recipes/casatools/build.sh
new file mode 100644
index 0000000000000..66bc23a998487
--- /dev/null
+++ b/recipes/casatools/build.sh
@@ -0,0 +1,6 @@
+#! /bin/bash
+
+set -xeuo pipefail
+cd casatools
+echo "$PKG_VERSION $PKG_VERSION - -" >version.txt
+exec python -m pip install . -vv --no-deps --no-build-isolation
diff --git a/recipes/casatools/macos-not-gcc.patch b/recipes/casatools/macos-not-gcc.patch
new file mode 100644
index 0000000000000..c12cfde9ccf68
--- /dev/null
+++ b/recipes/casatools/macos-not-gcc.patch
@@ -0,0 +1,22 @@
+diff --git a/casatools/setup.py b/casatools/setup.py
+index cd8944556f..05ffa8c97c 100644
+--- a/casatools/setup.py
++++ b/casatools/setup.py
+@@ -208,7 +208,7 @@ class XmlCMakeBuildExt(build_ext):
+         subprocess.check_call(['cmake', '--build', '.'])
+ 
+         # Copy GCC libs on Macos. 
+-        if (sys.platform == 'darwin'):
++        if False: # conda-forge: no
+             if (os.environ.get('FC') != None):
+                 fortran_compiler = os.environ.get('FC')
+             else:
+@@ -234,7 +234,7 @@ class XmlCMakeBuildExt(build_ext):
+                         sys.exit("\tGLIBC_PRIVATE cleanup failed...")
+ 
+             #Convert /opt/local/lib to @rpath on macOS
+-            if (sys.platform == 'darwin'):
++            if False: # conda-forge: no
+                 casac_lib_dir = extdir + "/casatools/__casac__/lib"
+                 from subprocess import call
+                 status=call("for f in `ls`; do if [[ $(otool -l $f | grep \"path /opt/local/lib\" | grep -v  \"/opt/local/lib/.*gcc\") ]];then install_name_tool -rpath /opt/local/lib  @loader_path:@loader_path/lib:@rpath $f ;fi; done",cwd=casac_lib_dir,shell=True)
diff --git a/recipes/casatools/meta.yaml b/recipes/casatools/meta.yaml
new file mode 100644
index 0000000000000..2b0bbfc2ce9fc
--- /dev/null
+++ b/recipes/casatools/meta.yaml
@@ -0,0 +1,106 @@
+{% set version = "6.7.2.12" %}
+{% set build = 0 %}
+{% set mpi = "openmpi" %}  # force this ... for now?
+{% set mpi_prefix = "mpi_" + mpi %}
+{% set build_pin = mpi_prefix + '_*' %}
+
+package:
+  name: casatools
+  version: {{ version }}
+
+source:
+  fn: casa-{{ version }}.tar.gz
+  url: https://open-bitbucket.nrao.edu/rest/api/latest/projects/CASA/repos/casa6/archive?at=refs%2Ftags%2F{{ version }}&format=tgz
+  sha256: 056511bfe4b662e8f4972a7ba3232eb71c8ecedcee2a7db47ceeda2ec1fd8c0a
+  patches:
+    - macos-not-gcc.patch  # [osx]
+
+build:
+  number: {{ build }}
+  skip: true  # [win]
+  string: {{ mpi_prefix }}_py{{ py }}h{{ PKG_HASH }}_{{ build }}
+
+requirements:
+  build:
+    - cmake <4
+    - libgomp      # [linux]
+    - llvm-openmp  # [osx]
+    - make
+    - openjdk
+    - pkg-config
+    - {{ compiler("c") }}
+    - {{ stdlib("c") }}
+    - {{ compiler("cxx") }}
+  host:
+    - {{ mpi }} 5  # temp: move ahead of global pin to get right casacore
+    - casacore >=3.7 {{ mpi_prefix }}_*
+    - casacpp {{ version }} {{ mpi_prefix }}_*
+    - libgomp      # [linux]
+    - llvm-openmp  # [osx]
+    - numpy
+    - pip
+    - python
+    - readline
+    - setuptools
+    - swig
+    - xerces-c
+  run:
+    - {{ mpi }} 5  # temp: move ahead of global pin to get right casacore
+    - casaconfig
+    - python
+
+test:
+  imports:
+    - casatools
+    - casatools.__casac__
+    - casatools.__casac__.agentflagger
+    - casatools.__casac__.atcafiller
+    - casatools.__casac__.atmosphere
+    - casatools.__casac__.calanalysis
+    - casatools.__casac__.calibrater
+    - casatools.__casac__.componentlist
+    - casatools.__casac__.coordsys
+    - casatools.__casac__.functional
+    - casatools.__casac__.imagemetadata
+    - casatools.__casac__.imagepol
+    - casatools.__casac__.image
+    - casatools.__casac__.imager
+    - casatools.__casac__.iterbotsink
+    - casatools.__casac__.linearmosaic
+    - casatools.__casac__.logsink
+    - casatools.__casac__.measures
+    - casatools.__casac__.miriadfiller
+    - casatools.__casac__.msmetadata
+    - casatools.__casac__.ms
+    - casatools.__casac__.mstransformer
+    - casatools.__casac__.msuvbinner
+    - casatools.__casac__.quanta
+    - casatools.__casac__.regionmanager
+    - casatools.__casac__.sakura
+    - casatools.__casac__.sdm
+    - casatools.__casac__.sidebandseparator
+    - casatools.__casac__.simulator
+    - casatools.__casac__.singledishms
+    - casatools.__casac__.spectralline
+    - casatools.__casac__.synthesisdeconvolver
+    - casatools.__casac__.synthesisimager
+    - casatools.__casac__.synthesisimstore
+    - casatools.__casac__.synthesismaskhandler
+    - casatools.__casac__.synthesisnormalizer
+    - casatools.__casac__.synthesisutils
+    - casatools.__casac__.table
+    - casatools.__casac__.tablerow
+    - casatools.__casac__.utils
+    - casatools.__casac__.vlafiller
+    - casatools.__casac__.vpmanager
+    - casatools.__casac__.wvr
+
+about:
+  home: http://casa.nrao.edu/
+  license: LGPL-2.1-or-later
+  license_file: casatasks/src/LICENSE.txt
+  summary: "Python tool implementations for CASA, the radio astronomical data processing package"
+
+extra:
+  recipe-maintainers:
+    - pkgw


Reviews:
user: login: xhochy
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-04-27T07:32:30Z
user: login: xhochy
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-27T16:58:33Z
user: login: pkgw
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-27T17:55:17Z
user: login: xhochy
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-28T12:27:11Z

Review comments:
diff_hunk: @@ -0,0 +1,105 @@
+{% set version = "6.7.2.12" %}
+{% set build = 0 %}
+{% set mpi = "openmpi" %}  # force this ... for now?
+{% set mpi_prefix = "mpi_" + mpi %}
+{% set build_pin = mpi_prefix + '_*' %}
+
+package:
+  name: casatools
+  version: {{ version }}
+
+source:
+  fn: casa-{{ version }}.tar.gz
+  url: https://open-bitbucket.nrao.edu/rest/api/latest/projects/CASA/repos/casa6/archive?at=refs%2Ftags%2F{{ version }}&format=tgz
+  sha256: 056511bfe4b662e8f4972a7ba3232eb71c8ecedcee2a7db47ceeda2ec1fd8c0a
+  patches:
+    - macos-not-gcc.patch  # [osx]
+
+build:
+  number: {{ build }}
+  skip: true  # [win]
+  string: {{ mpi_prefix }}_py{{ py }}h{{ PKG_HASH }}_{{ build }}
+
+requirements:
+  build:
+    - cmake <4
+    - libgomp      # [linux]
+    - llvm-openmp  # [osx]
path: recipes/casatools/meta.yaml
user: login: xhochy
body: Please also add them to host to ensure that we have the right run_exports 
created_at: 2025-04-27T07:31:55Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,105 @@
+{% set version = "6.7.2.12" %}
+{% set build = 0 %}
+{% set mpi = "openmpi" %}  # force this ... for now?
+{% set mpi_prefix = "mpi_" + mpi %}
+{% set build_pin = mpi_prefix + '_*' %}
+
+package:
+  name: casatools
+  version: {{ version }}
+
+source:
+  fn: casa-{{ version }}.tar.gz
+  url: https://open-bitbucket.nrao.edu/rest/api/latest/projects/CASA/repos/casa6/archive?at=refs%2Ftags%2F{{ version }}&format=tgz
+  sha256: 056511bfe4b662e8f4972a7ba3232eb71c8ecedcee2a7db47ceeda2ec1fd8c0a
+  patches:
+    - macos-not-gcc.patch  # [osx]
+
+build:
+  number: {{ build }}
+  skip: true  # [win]
+  string: {{ mpi_prefix }}_py{{ py }}h{{ PKG_HASH }}_{{ build }}
+
+requirements:
+  build:
+    - cmake <4
+    - libgomp      # [linux]
+    - llvm-openmp  # [osx]
+    - make
+    - openjdk
+    - pkg-config
+    - {{ compiler("c") }}
+    - {{ stdlib("c") }}
+    - {{ compiler("cxx") }}
+  host:
+    - {{ mpi }} 5  # temp: move ahead of global pin to get right casacore
+    - casacore >=3.7 {{ mpi_prefix }}_*
+    - casacpp {{ version }} {{ mpi_prefix }}_*
+    - numpy
+    - pip
+    - python
+    - readline
+    - setuptools
+    - swig
+    - xerces-c
+  run:
+    - {{ mpi }} 5  # temp: move ahead of global pin to get right casacore
+    - casaconfig
+    - {{ pin_compatible("numpy") }}
path: recipes/casatools/meta.yaml
user: login: xhochy
body: ```suggestion
```
numpy has a run_exports so this should no longer be used.

created_at: 2025-04-27T07:32:23Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,106 @@
+{% set version = "6.7.2.12" %}
+{% set build = 0 %}
+{% set mpi = "openmpi" %}  # force this ... for now?
+{% set mpi_prefix = "mpi_" + mpi %}
+{% set build_pin = mpi_prefix + '_*' %}
+
+package:
+  name: casatools
+  version: {{ version }}
+
+source:
+  fn: casa-{{ version }}.tar.gz
+  url: https://open-bitbucket.nrao.edu/rest/api/latest/projects/CASA/repos/casa6/archive?at=refs%2Ftags%2F{{ version }}&format=tgz
+  sha256: 056511bfe4b662e8f4972a7ba3232eb71c8ecedcee2a7db47ceeda2ec1fd8c0a
+  patches:
+    - macos-not-gcc.patch  # [osx]
+
+build:
+  number: {{ build }}
+  skip: true  # [win]
+  string: {{ mpi_prefix }}_py{{ py }}h{{ PKG_HASH }}_{{ build }}
+
+requirements:
+  build:
+    - cmake <4
+    - libgomp      # [linux]
+    - llvm-openmp 20  # [osx] ; match casacpp
path: recipes/casatools/meta.yaml
user: login: xhochy
body: Please fix casacpp. I'm requesting the addition to host everywhere to get rid of these errorneous pins.
created_at: 2025-04-27T16:58:30Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,106 @@
+{% set version = "6.7.2.12" %}
+{% set build = 0 %}
+{% set mpi = "openmpi" %}  # force this ... for now?
+{% set mpi_prefix = "mpi_" + mpi %}
+{% set build_pin = mpi_prefix + '_*' %}
+
+package:
+  name: casatools
+  version: {{ version }}
+
+source:
+  fn: casa-{{ version }}.tar.gz
+  url: https://open-bitbucket.nrao.edu/rest/api/latest/projects/CASA/repos/casa6/archive?at=refs%2Ftags%2F{{ version }}&format=tgz
+  sha256: 056511bfe4b662e8f4972a7ba3232eb71c8ecedcee2a7db47ceeda2ec1fd8c0a
+  patches:
+    - macos-not-gcc.patch  # [osx]
+
+build:
+  number: {{ build }}
+  skip: true  # [win]
+  string: {{ mpi_prefix }}_py{{ py }}h{{ PKG_HASH }}_{{ build }}
+
+requirements:
+  build:
+    - cmake <4
+    - libgomp      # [linux]
+    - llvm-openmp 20  # [osx] ; match casacpp
path: recipes/casatools/meta.yaml
user: login: pkgw
body: Got it. I was following [the knowledge base](https://conda-forge.org/docs/maintainer/knowledge_base/#openmp); perhaps it needs fixing?
created_at: 2025-04-27T17:55:17Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-04-17T20:09:38Z
body: Hi! This is the staged-recipes linter and your PR looks excellent! :rocket:


author_association: CONTRIBUTOR
user: login: conda-forge-admin
created_at: 2025-04-17T20:09:50Z
body: Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (```recipes/casatools/meta.yaml```, ```recipes/casatasks/meta.yaml```) and found it was in an excellent condition.

author_association: CONTRIBUTOR
user: login: pkgw
created_at: 2025-04-18T17:44:29Z
body: @conda-forge/help-python-c This should be ready for review now.
author_association: CONTRIBUTOR
user: login: pkgw
created_at: 2025-04-22T16:11:52Z
body: @conda-forge/help-python-c I've added the final CASA package, `casatasks`, to this PR. It's a `noarch: python` package, and it looks like it's causing the Windows build to fail. This is spurious since none of the CASA packages work on Windows anyway, and no Windows builds will be attempted once these recipes are in their own feedstocks.

Is the Windows failure OK here or should I hack something up to fix it up and get the tests all green?
author_association: CONTRIBUTOR
user: login: pkgw
created_at: 2025-04-23T14:00:03Z
body: @xhochy Could I trouble you to take a look at this? Thanks!
author_association: CONTRIBUTOR
user: login: pkgw
created_at: 2025-04-28T02:02:55Z
body: @xhochy OK, hopefully that's all straightened out now.
author_association: CONTRIBUTOR