{"library":"hydra-core","code":"import hydra\nfrom omegaconf import DictConfig, OmegaConf\nimport os\n\n# Create a config directory and file (e.g., conf/config.yaml)\n# In a real project, this would be a file on disk.\n# For this example, we simulate it.\n# Make sure to run `mkdir -p conf` first if running directly.\nconfig_content = \"\"\"\napp:\n  name: MyHydraApp\n  version: 1.0.0\ndb:\n  driver: mysql\n  user: ${oc.env:DB_USER, omry}\n  password: ${oc.env:DB_PASSWORD, secret}\n\"\"\"\n\n# Create a dummy config file for the quickstart to be runnable\n# In a typical setup, 'conf/config.yaml' would exist beforehand.\nif not os.path.exists('conf'):\n    os.makedirs('conf')\nwith open('conf/config.yaml', 'w') as f:\n    f.write(config_content)\n\n@hydra.main(version_base=\"1.3\", config_path=\"conf\", config_name=\"config\")\ndef my_app(cfg: DictConfig) -> None:\n    print(f\"Application Name: {cfg.app.name}\")\n    print(f\"Database Driver: {cfg.db.driver}\")\n    print(f\"Database User: {cfg.db.user}\")\n    print(f\"Database Password: {cfg.db.password}\")\n    print(f\"Original Working Directory: {hydra.utils.get_original_cwd()}\")\n    print(f\"Current Working Directory: {os.getcwd()}\")\n    print(OmegaConf.to_yaml(cfg))\n\nif __name__ == \"__main__\":\n    # Set environment variables for demonstration if not already set\n    os.environ['DB_USER'] = os.environ.get('DB_USER', 'my_db_user')\n    os.environ['DB_PASSWORD'] = os.environ.get('DB_PASSWORD', 'my_db_pass')\n    my_app()\n\n    # Clean up the dummy config file for repeated runs\n    os.remove('conf/config.yaml')\n    os.rmdir('conf')\n","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}