Skip to main content

Automagically generate yaml schemas for your Hydra config files

Project description

hydra-auto-schema

codecov

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.2.tar.gz (49.7 kB view details)

Uploaded Source

Built Distribution

hydra_auto_schema-0.0.2-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hydra_auto_schema-0.0.2.tar.gz
  • Upload date:
  • Size: 49.7 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.2.tar.gz
Algorithm Hash digest
SHA256 a6ba62a844998f4ccf4d0e7e549015c9fa669976e08855fd7550c557349a8a51
MD5 ce08c829a14afbe0e2129d9d178b4f47
BLAKE2b-256 5bb0a2e627531d68fe9f1f69d27ad23b8e85d751aba9dda62423cc5c974c16b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hydra_auto_schema-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92e2856d849584a268eedb8e03f359c67d58e81e92c3a07849ae4c40b4144cdf
MD5 4fdc992fc1d7b8396c890713d27fc1c5
BLAKE2b-256 9df3f3cba1ad11747ae8b81e069e58da0f0ee952033a58497dd94a2a17b2d8b7

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