|
| 1 | +--- |
| 2 | +globs: "*.py" |
| 3 | +--- |
| 4 | +# XCP-D Project Rules |
| 5 | + |
| 6 | +## Project Identity |
| 7 | + |
| 8 | +- Package: `xcp_d` -- fMRI postprocessing BIDS App |
| 9 | +- Default branch: `main` |
| 10 | +- Entry point: [xcp_d/cli/run.py](mdc:xcp_d/cli/run.py) |
| 11 | + |
| 12 | +## Linting & Formatting |
| 13 | + |
| 14 | +- Linter/formatter: ruff ~= 0.15.0 |
| 15 | +- Config: [pyproject.toml](mdc:pyproject.toml) under `[tool.ruff]` |
| 16 | +- Pre-commit: [.pre-commit-config.yaml](mdc:.pre-commit-config.yaml) with ruff v0.6.2 |
| 17 | +- Black is disabled (`[tool.black] exclude = ".*"`) |
| 18 | +- **Cleanest ignore list** of all four repos: only S105, S311, S603 |
| 19 | + |
| 20 | +## Version Management |
| 21 | + |
| 22 | +- Uses `__about__.py` pattern: [xcp_d/__about__.py](mdc:xcp_d/__about__.py) |
| 23 | +- Exports `__version__`, `__packagename__`, `__copyright__`, `__credits__` |
| 24 | +- `_version.py` is auto-generated by hatch-vcs; `__about__.py` imports from it |
| 25 | + |
| 26 | +## `fill_doc` Decorator |
| 27 | + |
| 28 | +Use `@fill_doc` (from `xcp_d.utils.doc`) on workflow init functions to inject shared |
| 29 | +parameter documentation. The decorator fills `%(parameter_name)s` placeholders in docstrings. |
| 30 | + |
| 31 | +## Config Hashing |
| 32 | + |
| 33 | +`config.hash_config()` creates unique identifiers for pipeline configurations. |
| 34 | +Used to detect when outputs need regeneration due to parameter changes. |
| 35 | +See `DEFAULT_CONFIG_HASH_FIELDS` in [xcp_d/config.py](mdc:xcp_d/config.py). |
| 36 | + |
| 37 | +## Ingression Modules |
| 38 | + |
| 39 | +`xcp_d/ingression/` adapts non-BIDS input formats: |
| 40 | +- `abcdbids.py`: ABCD-BIDS format |
| 41 | +- `hcpya.py`: HCP Young Adult format |
| 42 | +- `ukbiobank.py`: UK Biobank format |
| 43 | +When adding new input formats, create a module in this directory. |
| 44 | + |
| 45 | +## Executive Summary Reports |
| 46 | + |
| 47 | +HTML reports generated via Jinja2 templates in `xcp_d/data/executive_summary_templates/`. |
| 48 | +Interface: `xcp_d/interfaces/execsummary.py`; utils: `xcp_d/utils/execsummary.py`. |
| 49 | + |
| 50 | +## Key Module Paths |
| 51 | + |
| 52 | +- BOLD workflows: `xcp_d/workflows/bold/` (cifti, nifti, concatenation) |
| 53 | +- Anatomical workflows: `xcp_d/workflows/anatomical/` (surface, volume, parcellation) |
| 54 | +- Parcellation: [xcp_d/workflows/parcellation.py](mdc:xcp_d/workflows/parcellation.py) |
| 55 | +- Bundled atlases: `xcp_d/data/atlases/` (Glasser, Gordon, HCP, Tian, MIDB, MyersLabonte) |
| 56 | +- Nuisance configs: `xcp_d/data/nuisance/` (YAML strategy files) |
| 57 | +- Config: [xcp_d/config.py](mdc:xcp_d/config.py) |
| 58 | + |
| 59 | +## Testing |
| 60 | + |
| 61 | +- Test extras: `tests` in pyproject.toml |
| 62 | +- Parallel test execution supported via `pytest-xdist` |
| 63 | +- Integration test markers defined in `[tool.pytest.ini_options]` |
| 64 | +- `mock_config` context manager in `xcp_d/tests/tests.py` for workflow unit tests |
0 commit comments