Skip to content

Commit

Permalink
Clarify docs around custom resolvers (#3759)
Browse files Browse the repository at this point in the history
* Updated custom resolver docs section

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Updated advanced configuration section for consistency

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Updated RELEASE.md

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Updated RELEASE.md

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Test linkcheck_workers decrease

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Increased the By default, the linkcheck_rate_limit_timeout to default

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Returned old docs build settings

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Fixed typo

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Ignore forbidden url

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

* Returned linkcheck retries

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>

---------

Signed-off-by: Elena Khaustova <ymax70rus@gmail.com>
  • Loading branch information
ElenaKhaustova authored Apr 3, 2024
1 parent 776a661 commit 758ac45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Upcoming Release 0.19.4

## Major features and improvements
* Clarified docs around using custom resolvers without a full Kedro project.
* Improved error message when passing wrong value to node.
* Cookiecutter errors are shown in short format without the `--verbose` flag.
* Kedro commands now work from any subdirectory within a Kedro project.
Expand Down
21 changes: 17 additions & 4 deletions docs/source/configuration/advanced_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,9 @@ tree .
└── parameters.yml
```

Consider the following `parameters.yml` file and example Python script:

```yaml
# parameters.yml
learning_rate: 0.01
train_test_ratio: 0.7
```
Expand All @@ -342,7 +343,12 @@ config_loader = OmegaConfigLoader(conf_source=".")
# Optionally, you can also use environments
# config_loader = OmegaConfigLoader(conf_source=".", base_env="base", default_run_env="local")

>>> config_loader["parameters"]
print(config_loader["parameters"])
```

If you run it from the same directory where `parameters.yml` placed it gives the following output:

```console
{'learning_rate': 0.01, 'train_test_ratio': 0.7}
```

Expand All @@ -351,8 +357,9 @@ For the full list of features, please refer to [configuration_basics](./configur
### How to use Custom Resolvers with `OmegaConfigLoader`
You can register custom resolvers to use non-primitive types for parameters.

Consider the following `parameters.yml` file an example of Python script for registering a custom resolver:

```yaml
# parameters.yml
polars_float64: "${polars: Float64}"
today: "${today:}"
```
Expand All @@ -368,6 +375,12 @@ custom_resolvers = {"polars": lambda x: getattr(pl, x),

# Register custom resolvers
config_loader = OmegaConfigLoader(conf_source=".", custom_resolvers=custom_resolvers)
>>> print(config_loader["parameters"])

print(config_loader["parameters"])
```

If you run it from the same directory where `parameters.yml` placed it gives the following output:

```console
{'polars_float64': Float64, 'today': datetime.date(2023, 11, 23)}
```

0 comments on commit 758ac45

Please sign in to comment.