Skip to content

docs: add standalone reference page for @hydra.main() decorator#3136

Open
dhruvildarji wants to merge 1 commit intofacebookresearch:mainfrom
dhruvildarji:docs/hydra-main-detailed
Open

docs: add standalone reference page for @hydra.main() decorator#3136
dhruvildarji wants to merge 1 commit intofacebookresearch:mainfrom
dhruvildarji:docs/hydra-main-detailed

Conversation

@dhruvildarji
Copy link
Copy Markdown

Summary

Closes #845.

This PR adds website/docs/advanced/hydra_main.md, a dedicated reference page for the @hydra.main() decorator.

The page covers:

  • What @hydra.main() does — a plain-English description of the full runtime lifecycle (argument parsing, Hydra initialization, config composition, HydraConfig population, and task function invocation).
  • All parameters with type, default, and detailed description:
    • config_path — relative paths, pkg:// prefix, None, and how the default interacts with version_base.
    • config_name — how Hydra resolves the primary config file; what None means.
    • version_base — a table of supported values and their behavioral differences, with a recommendation to always set it explicitly.
  • Return value behavior — including the multirun note.
  • HydraConfig global state — how to access job name, output directory, and overrides from inside the task function; when HydraConfig.get() raises.
  • Common usage patterns — minimal app, app with config file, app with Structured Config, and a multirun sweep example.
  • Cross-references to the Compose API, decorating_main, and version_base upgrade guide.

The new page is registered in website/sidebars.js under Reference manual, immediately before the existing Compose API entry.

Test plan

  • Verify website/docs/advanced/hydra_main.md renders correctly in the Docusaurus dev server (cd website && npm start).
  • Confirm the new entry appears in the sidebar under Reference manual.
  • Check all internal links (compose_api.md, decorating_main.md, ../upgrades/version_base.md, search_path.md) resolve without 404s.
  • Review parameter descriptions against hydra/main.py for accuracy.

Adds website/docs/advanced/hydra_main.md with a comprehensive reference
page for the @hydra.main() decorator covering all parameters (config_path,
config_name, version_base), runtime behavior, HydraConfig global state,
return value semantics, and common usage patterns.

Registers the new page in website/sidebars.js under the Reference manual
section, before compose_api.

Closes facebookresearch#845
@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Feb 23, 2026

Hi @dhruvildarji!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a standalone page describing @hydra.main() in details.

1 participant