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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ name: Build
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
workflow_dispatch:

jobs:
job:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
# Versions listed at https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
python-version: [
"3.12",
'3.12',
]
steps:
- uses: actions/checkout@v6
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ name: Check Changelog

on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
types: [
assigned,
opened,
synchronize,
reopened,
labeled,
unlabeled,
]
branches:
- master

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build and upload to PyPI
name: Upload to PyPI

on: [push, pull_request]
on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
build_sdist_and_wheel:
Expand All @@ -11,7 +15,7 @@ jobs:
- uses: actions/setup-python@v6
name: Install Python
with:
python-version: "3.12"
python-version: '3.12'
- name: Install build
run: python -m pip install build
- name: Build sdist
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Run tests
on:
push:
branches:
- master
tags:
- '*'
pull_request:
schedule:
# run every Tuesday at 5am UTC
- cron: '0 5 * * 2'
workflow_dispatch:

jobs:
test:
strategy:
matrix:
os: [
ubuntu-latest,
macos-latest,
]
python-version: [
'3.12',
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install tox
run: |
uv tool install --python ${{ matrix.python-version }} tox --with tox-gh
- name: Run tests
run: tox
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
report_type: "test_results"
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
4.0.0 (Unreleased)
==================

- Added initial test suite, which checks the various CASA tasks and arguments used throughout the pipeline (#324)
- Bump actions/upload-artifact from 6 to 7 (#313)
- Update casaplotms requirement from >=2.7.4 to >=2.8.2 (#2.8.2)
- Bump casaplotms requirement from >=2.7.4 to >=2.8.2 (#320)
- Initial pip-installable version (#292)
6 changes: 4 additions & 2 deletions phangsPipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
__version__ = "dev"

from .handlerAlmaDownload import AlmaDownloadHandler
from .handlerDerived import DerivedHandler
from .handlerKeys import KeyHandler
from .handlerRelease import ReleaseHandler
from .phangsLogger import setup_logger
Expand Down Expand Up @@ -44,4 +43,7 @@

# Modules that require spectral-cube to be installed
if spectral_cube_enabled:
__all__.extend(["DerivedHandler"])
from .handlerDerived import DerivedHandler
__all__.extend([
"DerivedHandler",
])
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ casa = [
"pipeline@git+https://open-bitbucket.nrao.edu/scm/pipe/pipeline.git",
]

# Optional packages for the test suite
test = [
"pytest-cov >= 7.1.0",
]
test-casa = [
"zenodo-get >= 3.0.0",
]
test-ruff = [
"ruff >= 0.15.10",
]

[project.urls]
"Homepage" = "https://github.com/phangsTeam/phangs_imaging_scripts"
"Bug Reports" = "https://github.com/phangsTeam/phangs_imaging_scripts/issues"
Expand All @@ -68,6 +79,25 @@ exclude = [
"scripts/*",
]

# Omit in coverage. Notably here, we exclude
# the CASA analysisutils
[tool.coverage.run]
omit = [
"docs/*",
"phangs-alma_keys/*",
"tests/*",
"*/analysis_scripts/*",
]

[tool.coverage.report]
exclude_lines = [
'except ImportError',
'except ModuleNotFoundError',
'except \(ImportError, ModuleNotFoundError\)',
'raise AssertionError',
'raise NotImplementedError',
]

[build-system]
requires = [
"setuptools >= 80.9.0",
Expand Down
13 changes: 13 additions & 0 deletions pytest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[pytest]
minversion = "9.0"
addopts = [
"-ra",
"-q",
"--strict-markers",
]
markers = [
"casa: marks tests as requiring CASA install (deselect with '-m \"not casa\"')",
]
testpaths = [
"tests",
]
33 changes: 33 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
extend = "pyproject.toml"

extend-exclude = [
".github",
".tmp",
"phangs-alma_keys",
"phangsPipelineTests",
"scripts",
"tests/casa_config_files/*",
"run_pipeline_phangs-alma.py",
]

line-length = 100

target-version = "py312"

[format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true

[lint.pydocstyle]
convention = "numpy"

[lint.per-file-ignores]
"phangsPipeline/__init__.py" = [
"E402", # module-level import not at top of file
"F401", # unused import
]

"tests/test_*_imports.py" = [
"F401", # unused import
]
7 changes: 7 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os
import sys

# Add the analysisUtils directory to PATH
envdir = os.environ.get("ENVDIR", os.getcwd())
au_dir = os.path.join(envdir, "analysis_scripts")
sys.path.append(au_dir)
8 changes: 8 additions & 0 deletions tests/casa_config_files/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os

casadir = os.environ.get("CASADIR", os.getcwd())

datapath = [os.path.join(casadir, "data")]
measurespath = datapath[0]
measures_auto_update = True
data_auto_update = True
10 changes: 10 additions & 0 deletions tests/casa_config_files/startup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os
import sys

envdir = os.environ.get("ENVDIR", os.getcwd())

au_dir = os.path.join(envdir, "analysis_scripts")
sys.path.append(au_dir)

import analysisUtils as au
aU = au
Loading
Loading