Skip to main content
Version: 0.11

Simple command line application

This is a simple Hydra application that prints your configuration. The my_app function is a place holder for your code. We will slowly evolve this example to show-case more Hydra features.

The examples in this tutorial are available here.

Python file:

import hydra

def my_app(cfg):

if __name__ == "__main__":

The cfg is an OmegaConf object that holds the configuration for your function. You don't need a deep understanding of OmegaConf for this tutorial.

We can pass arbitrary command line arguments from which Hydra creates a hierarchical configuration object:

$ python db.driver=mysql db.user=omry db.pass=secret
driver: mysql
pass: secret
user: omry