Skip to main content

Automagically generate yaml schemas for your Hydra config files

Project description

hydra-auto-schema

This tool greatly improves the experience of developing a project with Hydra by enabling rich IDE support for Hydra config files.

📢 If you are thinking of using Hydra for a PyTorch or Jax-based ML project, you might want to take a look at the Research Project Template where this plugin was originally created. This is also where this plugin is best integrated!

With this, you'll now get to see:

  • the list of available configuration options in a given config
  • the default values for each entry
  • the documentation associated with each entry (taken from the source code of the _target_ callable!) Additionally
  • A warning is displayed when a value is unexpected, or of the wrong type.

All-in-all, this helps to prevent errors, and gives your codebase the same kind of neatness and safety that type hints do.

Demo

https://github.com/user-attachments/assets/08f52d47-ebba-456d-95ef-ac9525d8e983

Installation

Requirements

At the moment, we assume that you are using VSCode as your code editor. We use the yaml extension by RedHat, and install it for you if it isn't already. However any IDE with a YAML language server should be fairly easy to make work. Please make an issue if this doesn't work with your IDE.

uv (recommended)

uv add git+https://www.github.com/lebrice/hydra-auto-schema

Note: This plugin needs to be installed in your project's virtual environment. It should not be installed as an isolated tool using uv tool. This is because the plugin needs to import the modules where the _target_s are defined in order to inspect their signature.

pip

pip install git+https://www.github.com/lebrice/hydra-auto-schema

Usage

Generate the yaml schemas for all the configs in the configs folder:

hydra-auto-schema configs

Watch for changes in the configs folder and update the schemas as needed:

hydra-auto-schema configs --watch

How to Contribute

This is a very new tool, and we'd love to get your feedback! Please feel free to make an Issue if you have any questions or feedback. We'll be happy to assist you.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hydra_auto_schema-0.0.1.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

hydra_auto_schema-0.0.1-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file hydra_auto_schema-0.0.1.tar.gz.

File metadata

  • Download URL: hydra_auto_schema-0.0.1.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for hydra_auto_schema-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2074f45ada1cb9681654974d079d61f34e988f947ea7425a492452c448a85890
MD5 4143a48ff0f33fe8c6a230b2336ad0d6
BLAKE2b-256 63fe57fffe683ab48c21def07182f10b0184d04d518131c26c89c170b071f738

See more details on using hashes here.

File details

Details for the file hydra_auto_schema-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hydra_auto_schema-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 30c44d7bac7c4fdcd1333fa4b6407271488eea36cf195c9396b9dd79da1e5dd7
MD5 3e06311c6b3cac269ba385d1369bc949
BLAKE2b-256 3ea6ac865fad1598b233a620d230a2a8273b105b8a3c000d2adce4a2a8912c26

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page