# kd.kontext

[[[Source]]](https://github.com/google-research/kauldron/tree/main/kauldron/kontext/__init__.py)

```{eval-rst}
.. automodule:: kauldron.kontext
  :no-members:
```

## Symbols


### Class

|  |  |
--- | ---
[kd.kontext.Context](Context) | 
[kd.kontext.GlobPath](GlobPath) | Represents a string path.
[kd.kontext.Path](Path) | Represents a (non-glob) string path.

### Function

|  |  |
--- | ---
[kd.kontext.filter_by_path](filter_by_path) | Filters a context by a path.
[kd.kontext.flatten_with_path](flatten_with_path) | Flatten any PyTree / ConfigDict into a dict with 'keys.like[0].this'.
[kd.kontext.get_by_path](get_by_path) | Get (nested) item or attribute by given path.
[kd.kontext.get_keypaths](get_keypaths) | Return a dictionary mapping Key-annotated fieldnames to their paths.
[kd.kontext.is_key_annotated](is_key_annotated) | Check if a given class or instance has fields annotated with `Key`.
[kd.kontext.path_builder_from](path_builder_from) | Create a path builder from a class.
[kd.kontext.resolve_from_keyed_obj](resolve_from_keyed_obj) | Resolve the Key annotations of an object for given context.
[kd.kontext.resolve_from_keypaths](resolve_from_keypaths) | Get values for key_paths from context with useful errors when failing.
[kd.kontext.set_by_path](set_by_path) | Mutate the `obj` to set the value.

### Attribute

|  |  |
--- | ---
[kd.kontext.REQUIRED](REQUIRED) | 

### Typing

|  |  |
--- | ---
[kd.kontext.Key](Key) | 
[kd.kontext.KeyTree](KeyTree) | 

```{toctree}
:hidden:

Context
GlobPath
Key
KeyTree
Path
REQUIRED
filter_by_path
flatten_with_path
get_by_path
get_keypaths
is_key_annotated
path_builder_from
resolve_from_keyed_obj
resolve_from_keypaths
set_by_path
```