Skip to content

Main functions

hya

Contain the main features of the hya package.

hya.get_default_registry

get_default_registry() -> ResolverRegistry

Get or create the default global resolver registry.

Returns a singleton registry instance using a simple singleton pattern. The registry is initially empty and can be populated with custom resolvers.

This function uses a singleton pattern to ensure the same registry instance is returned on subsequent calls, which is efficient and maintains consistency across an application.

Returns:

Type Description
ResolverRegistry

A ResolverRegistry instance

Notes

The singleton pattern means modifications to the returned registry affect all future calls to this function. If you need an isolated registry, create a new ResolverRegistry instance directly.

Example
>>> from hya import get_default_registry
>>> registry = get_default_registry()
>>> @registry.register("my_key")
... def my_resolver(value):
...     pass
...