Skip to content

Commit 3599523

Browse files
cailmdaleyclaude
andcommitted
test: expand xfail list with failures surfaced by CI
The fresh CI container reveals more pre-existing issues than our older local container did. Mark them strict-xfail with reasons; GH issues track the actual fixes. New xfails: - shapepipe.canfar.canfar_monitor + shapepipe.canfar_run: IndentationError in canfar_monitor.py:55 (docstring at 7 spaces, body at 8) - mask + mask_runner: astroquery not in develop Docker image - ngmix + ngmix_runner: numba not in develop Docker image - split_exp + split_exp_runner: pkg_resources removed in newer setuptools - uncompress_fits + uncompress_fits_runner: fitsio not installed - canfar_submit_job, canfar_monitor, canfar_monitor_log entry points: transitive on the canfar_monitor.py IndentationError Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f362ba1 commit 3599523

4 files changed

Lines changed: 143 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## What is ShapePipe
6+
7+
ShapePipe is a galaxy shape measurement pipeline for weak gravitational lensing, developed at CosmoStat (CEA Paris-Saclay). It orchestrates astronomical processing modules (SExtractor, PSFEx, MCCD, ngmix, etc.) into configurable pipeline runs. Source: `src/shapepipe/`.
8+
9+
## Build & Install
10+
11+
```bash
12+
# Development install (editable, with all extras)
13+
pip install -e ".[dev]"
14+
15+
# Full install with external dependencies (Conda + external tools)
16+
./install_shapepipe --develop
17+
18+
# Container (recommended for full pipeline)
19+
# ghcr.io/cosmostat/shapepipe — see Dockerfile
20+
```
21+
22+
Requires Python >= 3.11. Core deps: joblib, modopt, numpy. Many modules need external executables (source-extractor, psfex, etc.) installed separately.
23+
24+
## Running
25+
26+
```bash
27+
# Run pipeline with config file
28+
shapepipe_run -c <config.ini>
29+
30+
# MPI mode
31+
mpiexec -n <cores> shapepipe_run -c <config.ini>
32+
```
33+
34+
Config files are INI format with sections: `[DEFAULT]`, `[EXECUTION]`, `[FILE]`, `[JOB]`, `[WORKER]`, plus per-module sections like `[SEXTRACTOR_RUNNER]`. See `example/config.ini` for annotated reference, `example/cfis/` for production configs.
35+
36+
## Testing
37+
38+
```bash
39+
# Run all tests (pytest configured in pyproject.toml)
40+
pytest
41+
42+
# Run a single test file
43+
pytest src/shapepipe/tests/test_pipeline.py
44+
45+
# Run a specific test
46+
pytest src/shapepipe/tests/test_pipeline.py::ExecuteTestCase::test_execute
47+
```
48+
49+
pytest is configured with `--verbose --cov=shapepipe`, testpaths = `["shapepipe"]`. Tests use `unittest.TestCase` with `numpy.testing`.
50+
51+
## Linting
52+
53+
```bash
54+
black src/shapepipe/
55+
isort src/shapepipe/
56+
```
57+
58+
## Architecture
59+
60+
### Pipeline engine (`pipeline/`)
61+
62+
`ShapePipe` class in `run.py` is the main orchestrator:
63+
1. `args.py` parses CLI args → `config.py` (`CustomParser`) reads INI config
64+
2. `file_handler.py` resolves input/output paths, discovers files by pattern/numbering
65+
3. `dependency_handler.py` checks Python + executable dependencies
66+
4. `job_handler.py` dispatches work via joblib (SMP) or mpi4py (MPI)
67+
5. `worker_handler.py` + `execute.py` run each module, with `timeout.py` support
68+
69+
`file_handler.py` and `file_io.py` are the largest/most complex files — they manage the numbering schemes, inter-module file routing (`last:MODULE`, `all:MODULE` patterns), and output directory structure.
70+
71+
### Module system (`modules/`)
72+
73+
Each processing step is a module with:
74+
- `<name>_runner.py` — decorated with `@module_runner` from `module_decorator.py`
75+
- `<name>_package/` — implementation classes/functions
76+
77+
The `@module_runner` decorator declares: `version`, `input_module`, `file_pattern`, `file_ext`, `depends`, `executes`, `numbering_scheme`, `run_method` (parallel/serial).
78+
79+
Runner signature: `def runner(input_file_list, run_dirs, file_number_string, config, module_config_sec, w_log)` → returns `(stdout, stderr)`.
80+
81+
When a module appears multiple times in `[EXECUTION] MODULE`, its config section gets a `_RUN_N` suffix (e.g., `PYTHON_EXAMPLE_RUNNER_RUN_1`, `PYTHON_EXAMPLE_RUNNER_RUN_2`).
82+
83+
### Utilities (`utilities/`)
84+
85+
- `cfis.py` — CFIS survey-specific helpers (largest utility, ~35KB)
86+
- `summary.py` — pipeline run summary generation
87+
- `file_system.py`, `galaxy.py` — general helpers
88+
89+
### Scripts (`scripts/`)
90+
91+
Python and shell scripts symlinked into the environment during install. Used for catalog creation, merging, and CANFAR cluster operations.
92+
93+
## Style conventions
94+
95+
- Single quotes preferred over double quotes
96+
- Explicit floats: `1.0` not `1.`
97+
- f-strings for formatting
98+
- Line length: 79 characters max; break with `()` not `\`
99+
- Numpydoc-style docstrings
100+
- String concatenation in f-strings: use `+` at start of continuation line

tests/unit/test_entrypoints.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
KNOWN_XFAIL = {
2121
"summary_run":
2222
"treats '-h' as the 'patch' positional arg, tries to mkdir '-h'",
23+
# All three import shapepipe.canfar_run, which fails with
24+
# IndentationError in canfar_monitor.py:55.
25+
"canfar_submit_job":
26+
"IndentationError in canfar_monitor.py:55 (transitive)",
27+
"canfar_monitor":
28+
"IndentationError in canfar_monitor.py:55 (transitive)",
29+
"canfar_monitor_log":
30+
"IndentationError in canfar_monitor.py:55 (transitive)",
2331
}
2432

2533

tests/unit/test_imports.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
# lands green but the failure is discoverable and auto-notifies (via
2121
# ``strict=True``) once the upstream fix lands.
2222
KNOWN_XFAIL = {
23+
# IndentationError at canfar_monitor.py:55 (docstring/body mismatch).
24+
"shapepipe.canfar.canfar_monitor":
25+
"IndentationError in canfar_monitor.py:55",
26+
"shapepipe.canfar_run":
27+
"IndentationError in canfar_monitor.py:55 (transitive)",
28+
# stile v0.1 hard-imports treecorr.corr2, which newer treecorr removed.
2329
"shapepipe.modules.mccd_package.mccd_plot_utilities":
2430
"stile v0.1 imports removed treecorr.corr2",
2531
"shapepipe.modules.mccd_plots_runner":
@@ -28,6 +34,25 @@
2834
"stile v0.1 imports removed treecorr.corr2",
2935
"shapepipe.modules.random_cat_runner":
3036
"stile v0.1 imports removed treecorr.corr2",
37+
# Modules added in v1.x Dockerfile rewrites that import deps not in
38+
# the develop image (astroquery, numba, fitsio) or removed from
39+
# stdlib/setuptools (pkg_resources).
40+
"shapepipe.modules.mask_package.mask":
41+
"astroquery not in develop Docker image",
42+
"shapepipe.modules.mask_runner":
43+
"astroquery not in develop Docker image (transitive)",
44+
"shapepipe.modules.ngmix_package.ngmix":
45+
"numba not in develop Docker image",
46+
"shapepipe.modules.ngmix_runner":
47+
"numba not in develop Docker image (transitive)",
48+
"shapepipe.modules.split_exp_package.split_exp":
49+
"uses deprecated pkg_resources (setuptools>=68)",
50+
"shapepipe.modules.split_exp_runner":
51+
"uses deprecated pkg_resources (transitive)",
52+
"shapepipe.modules.uncompress_fits_package.uncompress_fits":
53+
"fitsio not installed (declared as optional extra)",
54+
"shapepipe.modules.uncompress_fits_runner":
55+
"fitsio not installed (transitive)",
3156
}
3257

3358

tests/unit/test_runner_metadata.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,20 @@
3434
# Modules imported here but broken upstream — tracked separately.
3535
# Mapping: module name → xfail reason.
3636
KNOWN_XFAIL = {
37-
# Both reach stile, which imports treecorr.corr2 (removed in treecorr 5.x).
37+
# Transitive failures: the runner's own import chain breaks before
38+
# we can check metadata. Root causes tracked in test_imports.py.
3839
"shapepipe.modules.mccd_plots_runner":
3940
"stile v0.1 imports removed treecorr.corr2",
4041
"shapepipe.modules.random_cat_runner":
4142
"stile v0.1 imports removed treecorr.corr2",
43+
"shapepipe.modules.mask_runner":
44+
"astroquery not in develop Docker image",
45+
"shapepipe.modules.ngmix_runner":
46+
"numba not in develop Docker image",
47+
"shapepipe.modules.split_exp_runner":
48+
"uses deprecated pkg_resources (setuptools>=68)",
49+
"shapepipe.modules.uncompress_fits_runner":
50+
"fitsio not installed (declared as optional extra)",
4251
}
4352

4453

0 commit comments

Comments
 (0)