Skip to content

Commit

Permalink
fix: backwards compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Brugman <sfbbrugman@gmail.com>
  • Loading branch information
sbrugman committed Oct 9, 2023
1 parent 15fe38d commit e3dec7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions kedro-airflow/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Added support for Python 3.11
* Added the `--all` CLI argument to `kedro-airflow` to convert registered all pipelines at once.
* Simplify the output of the `kedro airflow create` command.
* Fixed compatibility of `kedro-airflow` with older versions of the config loaders (`kedro<=0.18.2`).

## Community contributions
Many thanks to the following Kedroids for contributing PRs to this release:
Expand Down
13 changes: 9 additions & 4 deletions kedro-airflow/kedro_airflow/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,22 @@ def airflow_commands():


def _load_config(context: KedroContext) -> dict[str, Any]:
# Backwards compatibility for ConfigLoader that does not support `config_patterns`
config_loader = context.config_loader
if not hasattr(config_loader, "config_patterns"):
return config_loader.get("airflow*", "airflow/**")

# Set the default pattern for `airflow` if not provided in `settings.py`
if "airflow" not in context.config_loader.config_patterns.keys():
context.config_loader.config_patterns.update( # pragma: no cover
if "airflow" not in config_loader.config_patterns.keys():
config_loader.config_patterns.update( # pragma: no cover
{"airflow": ["airflow*", "airflow/**"]}
)

assert "airflow" in context.config_loader.config_patterns.keys()
assert "airflow" in config_loader.config_patterns.keys()

# Load the config
try:
return context.config_loader["airflow"]
return config_loader["airflow"]
except MissingConfigException:
# File does not exist
return {}
Expand Down

0 comments on commit e3dec7c

Please sign in to comment.