|
| 1 | +# AGENTS |
| 2 | + |
| 3 | +## Repository purpose |
| 4 | + |
| 5 | +`zppy` is a post-processing workflow tool that runs specialized |
| 6 | +post-processing tools. |
| 7 | + |
| 8 | +Each task is defined by: |
| 9 | + |
| 10 | +1. A Python task file in `zppy/` that reads user-provided `cfg` values. |
| 11 | +2. A Jinja2 bash template in `zppy/templates/`. |
| 12 | +3. A generated bash script that `zppy` launches. |
| 13 | + |
| 14 | +`zppy-interfaces` is a distinct repository and contains plotting packages used |
| 15 | +by `zppy`. |
| 16 | + |
| 17 | +## Project overview |
| 18 | + |
| 19 | +`zppy` orchestrates post-processing tasks from user config (`cfg`) values. The |
| 20 | +task Python modules in `zppy/` translate cfg options into executable scripts |
| 21 | +from templates in `zppy/templates/`, then launch those scripts. |
| 22 | + |
| 23 | +## Key design decisions |
| 24 | + |
| 25 | +- Keep task logic in Python and execution logic in Jinja2 bash templates. |
| 26 | +- Keep repository boundaries clear: `zppy` controls workflow orchestration, |
| 27 | + while plotting packages live in `zppy-interfaces`. |
| 28 | +- Prefer minimal changes for maintenance work to avoid altering behavior. |
| 29 | + |
| 30 | +## Repository layout |
| 31 | + |
| 32 | +- `docs/source`: documentation sources. |
| 33 | +- `tests/`: test files. |
| 34 | +- `zppy/`: Python task and workflow control logic. |
| 35 | +- `zppy/templates`: bash templates used to control individual tasks. |
| 36 | + |
| 37 | +## Tech stack |
| 38 | + |
| 39 | +- Python for workflow/task orchestration. |
| 40 | +- Jinja2 templates to generate bash scripts. |
| 41 | +- pytest for unit and integration tests. |
| 42 | + |
| 43 | +## Code style |
| 44 | + |
| 45 | +- Follow existing style in nearby files and keep changes minimal/surgical. |
| 46 | +- Avoid over-engineering; prefer straightforward updates. |
| 47 | +- Do not change behavior in non-functional updates. |
| 48 | + |
| 49 | +## Setting up a development environment |
| 50 | + |
| 51 | +Use a clean environment and install from source: |
| 52 | + |
| 53 | +```bash |
| 54 | +python -m pip install . |
| 55 | +``` |
| 56 | + |
| 57 | +For integration workflows, create separate conda environments for |
| 58 | +`e3sm_diags`, `zppy-interfaces`, and `zppy`. |
| 59 | + |
| 60 | +## Testing |
| 61 | + |
| 62 | +### Unit and integration tests in this repo |
| 63 | + |
| 64 | +```bash |
| 65 | +python -m pip install . |
| 66 | +pytest tests/test_*.py |
| 67 | +``` |
| 68 | + |
| 69 | +For integration tests, see `tests/integration/` and run: |
| 70 | + |
| 71 | +```bash |
| 72 | +pytest tests/integration/test_*.py |
| 73 | +``` |
| 74 | + |
| 75 | +### Full weekly/integration workflow context |
| 76 | + |
| 77 | +The common workflow is: |
| 78 | + |
| 79 | +1. Prepare clean conda environments for: |
| 80 | + - `e3sm_diags` |
| 81 | + - `zppy-interfaces` |
| 82 | + - `zppy` |
| 83 | +2. Install each package from source in its environment. |
| 84 | +3. Update `tests/integration/utils.py` `TEST_SPECIFICS` environment command |
| 85 | + values for the current environment names. |
| 86 | +4. Generate integration cfg files: |
| 87 | + |
| 88 | + ```bash |
| 89 | + python tests/integration/utils.py |
| 90 | + ``` |
| 91 | + |
| 92 | +5. Launch `zppy` with generated cfg files in `tests/integration/generated/`. |
| 93 | +6. Check generated `*status` files (for example with `grep -v "OK" *status`). |
| 94 | +7. Run integration pytest files under `tests/integration/`. |
| 95 | +8. For `test_images.py`, run on a compute node and inspect |
| 96 | + `test_images_summary.md`. |
| 97 | + |
| 98 | +### When to add or modify tests |
| 99 | + |
| 100 | +When to add tests: |
| 101 | +- Adding new features or internal functions (add unit and/or integration tests |
| 102 | + for the changed behavior). |
| 103 | +- Fixing a bug (add a regression test that fails before the fix and passes |
| 104 | + after it). |
| 105 | + |
| 106 | +When to modify tests: |
| 107 | +- Modifying existing features or internal functions. |
| 108 | + |
| 109 | +When not to modify tests: |
| 110 | +- Non-functional changes that should not change behavior (for example, |
| 111 | + documentation-only updates, formatting-only changes, or compatibility updates |
| 112 | + for new Python versions). |
| 113 | + |
| 114 | +## Git workflow |
| 115 | + |
| 116 | +- Keep each change focused and as small as possible. |
| 117 | +- Use the existing PR review process and address reviewer comments directly. |
| 118 | + |
| 119 | +## Adding dependencies |
| 120 | + |
| 121 | +- Add new dependencies only when necessary. |
| 122 | +- Record dependency updates in the appropriate repository dependency files |
| 123 | + (for example, under `zppy/conda` when applicable), not only as imports. |
0 commit comments