HYRAX_GUIDE.mdis the canonical reference for architecture, config system, registries, and conventions. This file contains only Claude Code-specific overrides. When in doubt, followHYRAX_GUIDE.md.
Hyrax is a low-code ML platform for astronomy built on PyTorch. Key workflows:
download survey cutouts → train models → infer latent representations → visualize.
Primary interface is Jupyter notebooks; the hyrax CLI is secondary (HPC/Slurm).
- Style: Run
ruff check src/ tests/ && ruff format src/ tests/and let the linter fix issues. Do not hand-tune formatting. - Tests:
python -m pytest -m "not slow"for the fast suite. - Pre-commit:
pre-commit run --all-filesbefore finishing work. - Docs:
sphinx-build -M html ./docs ./_readthedocs
- Python ≥ 3.11 — use modern syntax (
match,X | Yunions, etc.). - Line length: 110 (enforced by ruff).
- Rely on the linter — do not manually reformat surrounding code.
- Add docstrings to new public functions; follow existing NumPy-style conventions.
- Never commit code containing the note-to-self marker (
xcrepeated twice). A pre-commit hook will block the commit.
- Create a file in
src/hyrax/models/. - Inherit from
torch.nn.Module, decorate the class with@hyrax_model. - Implement
__init__,forward,train_step, andprepare_inputs. - Add default config under
[model.YourModelName]inhyrax_default_config.toml. - Add tests in
tests/hyrax/test_<name>.py.
- Create a file in
src/hyrax/data_sets/. - Subclass
HyraxDataset(auto-registered via__init_subclass__). UseDatasetspelling. - For image datasets, also inherit
HyraxImageDatasetfor transform stacking. - Add default config under
[data_set.YourDatasetName]inhyrax_default_config.toml.
- Create a file in
src/hyrax/verbs/. - Subclass
Verb, setcli_name, decorate with@hyrax_verb. - Implement
setup_parser,run_cli, andrun. - Verbs are internal only. Always use class-based verbs (function-based verbs are legacy).
See HYRAX_GUIDE.md for the full list. Key points:
key = falsemeansNone— TOML has no null. Hyrax usesfalseas a sentinel for "not set." Code must treatFalseasNonefor these keys.ConfigDictis Pydantic's —from pydantic import ConfigDict. The runtime config is an ordinary mutabledict, not a custom wrapper.- Verbs are internal only — external plugins register models and datasets, not verbs.
- Manifest files — ask the user before extending this pattern.
- Pydantic validation — do not add to new config sections.