Hydra is an open-source Python framework developed by Facebook Research for elegantly configuring complex applications. It enables hierarchical configuration, command-line overrides, multi-run experiments, and dynamic object instantiation. Hydra maintains a regular release cadence with both major and patch versions to introduce new features and address bugs.
pip install hydra-core --upgradeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a basic Hydra application. It defines a configuration in `conf/config.yaml`, uses `@hydra.main` to load it, and accesses configuration values via dot notation. It also shows how to use environment variables and retrieve working directory paths.
Upgrade your Python environment to 3.7 or newer, or pin your `hydra-core` dependency to `<1.3.2`.
To maintain previous behavior or control composition, explicitly add `_self_` to your `defaults` list. Place `_self_` at the beginning for defaults to override the primary config, or at the end for the primary config to override defaults. Refer to the official upgrade guide for details.
Refer to the comprehensive 1.0 to 1.1 upgrade guide in the official Hydra documentation. It's recommended to upgrade to the latest 1.0 patch version first and address all warnings before proceeding to 1.1.
Always specify `version_base` in `@hydra.main`. Use `version_base=None` to opt into the latest behavior, or a specific version string (e.g., `'1.1'`, `'1.2'`, `'1.3'`) to maintain behavior compatible with that version.
To reliably get the directory where your script was initially executed, use `hydra.utils.get_original_cwd()`. If you need the job's output directory, you can retrieve it from `hydra.core.hydra_config.HydraConfig.get().runtime.output_dir`.
Always ensure your `omegaconf` installation is compatible with your `hydra-core` version. Check the `hydra-core` PyPI page or `requirements.txt` on GitHub for the exact `omegaconf` version range. Use `pip install hydra-core --upgrade` to ensure compatible versions are installed.