Aiming to reduce the need for boilerplate code and speed up the development of complex Python applications, Facebook Engineering has created an open source framework called Hydra. Hydra allows developers to “compose” the configurations of applications from the command line or from configuration files.
Facebook says Hydra offers a flexible approach to developing and maintaining code and configurations, thus speeding up the development of complex applications in fields such as machine learning research. Offered under an MIT license, Hydra lets developers compose and override configurations.
Other promised benefits of Hydra include:
- Making it easier to add functionality to projects for new use cases and requirements with no need to rewrite significant portions of code.
- A reduction in the need for some boilerplate code common in complex applications, such as manipulating configuration files, configuration logging, and defining command-line flags.
With Hydra, changes to a composition can be done through configuration files or from the command line. This addresses issues that can arise when modifying a config, such as maintaining slightly different copies of a configuration or adding logic to override configuration values. Configuration can be composed and overridden just prior to running the application. Dynamic command-line tab completion assists developers with discoverability of complex configurations and reduces errors. Applications can be launched locally or remotely, enabling users to take advantage of more local resources.
Facebook engineers use Hydra for prototyping complex research projects. It has a pluggable architecture for adding new features in the future, whether internally from Facebook or from the community. Future plug-ins are planned that will enable the launching of code from Amazon Web Services or other clouds via the command line.
Where to download Hydra
You can download Hydra from GitHub.
Join the CIO Australia group on LinkedIn. The group is open to CIOs, IT Directors, COOs, CTOs and senior IT managers.