title: How to get a Hydra config without using @hydra.main()
body: <p>Let's say we have following setup (copied &amp; shortened from the <a href="https://hydra.cc/docs/intro/" rel="noreferrer">Hydra docs</a>):</p>
  
  <p>Configuration file: <code>config.yaml</code></p>
  
  <pre><code>db:
    driver: mysql
    user: omry
    pass: secret
  </code></pre>
  
  <p>Python file: <code>my_app.py</code></p>
  
  <pre><code>import hydra
  @hydra.main(config_path="config.yaml")
  def my_app(cfg):
      print(cfg.pretty())
  if __name__ == "__main__":
      my_app()
  </code></pre>
  
  <p>This works well when we can use a decorator on the function <code>my_app</code>. Now I would like (for small scripts and testing purposes, but that is not important) to get this <code>cfg</code> object outside of any function, just in a plain python script. From what I understand how decorators work, it should be possible to call</p>
  
  <pre><code>import hydra
  cfg = hydra.main(config_path="config.yaml")(lambda x: x)()
  print(cfg.pretty())
  </code></pre>
  
  <p>but then <code>cfg</code> is just <code>None</code> and not the desired configuration object. So it seems that the decorator does not pass on the returned values. Is there another way to get to that <code>cfg</code> ?</p>