Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for kedro>0.18.4,<=0.19.6 #266

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
steps:
# Spellcheck
- uses: actions/checkout@v2
- uses: rojopolis/spellcheck-github-actions@0.25.0
- uses: rojopolis/spellcheck-github-actions@0.35.0
name: Spellcheck
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
- name: Initialize kedro spaceflights project
run: |
pip install .
kedro new --starter spaceflights --config tests/e2e/starter-config.yml --verbose
kedro new --starter spaceflights-pandas --config tests/e2e/starter-config.yml --verbose

- name: Install project dependencies
working-directory: ./spaceflights
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: flake8
args: ['--ignore=E203,W503'] # see https://github.com/psf/black/issues/315 https://github.com/psf/black/issues/52
- repo: https://github.com/getindata/py-pre-commit-hooks
rev: v0.1.3
rev: v0.2.0
hooks:
- id: pyspelling-docker
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
40 changes: 20 additions & 20 deletions .spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ matrix:
- "README.md"
default_encoding: utf-8
pipeline:
- pyspelling.filters.context:
context_visible_first: true
escapes: \\[\\`~]
delimiters:
# Ignore multiline content between fences (fences can have 3 or more back ticks)
# ```
# content
# ```
- open: '^(?s)(?P<open>`{1,3})[^`]'
close: '(?P=open)'
# Ignore text between inline back ticks
- open: '(?P<open>`)[^`]'
close: '(?P=open)'
# Ignore text in brackets [] and ()
- open: '\['
close: '\]'
- open: '\('
close: '\)'
- open: '\{'
close: '\}'
- pyspelling.filters.context:
context_visible_first: true
escapes: \\[\\`~]
delimiters:
# Ignore multiline content between fences (fences can have 3 or more back ticks)
# ```
# content
# ```
- open: '(?s)^(?P<open>`{1,3})[^`]'
close: '(?P=open)'
# Ignore text between inline back ticks
- open: '(?P<open>`)[^`]'
close: '(?P=open)'
# Ignore text in brackets [] and ()
- open: '\['
close: '\]'
- open: '\('
close: '\)'
- open: '\{'
close: '\}'
dictionary:
wordlists:
- docs/spellcheck_exceptions.txt
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

- Updated dependencies, bumped kedro to 0.18.9, mlflow to 2.3.2
- Add support for `kedro>0.18.4,<=0.19.6`

## [0.7.4] - 2023-02-27

Expand Down
20 changes: 13 additions & 7 deletions kedro_kubeflow/context_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
from typing import Any, Dict

from kedro import __version__ as kedro_version
from kedro.config import TemplatedConfigLoader
from kedro.config import OmegaConfigLoader
from kedro.framework.session import KedroSession
from omegaconf.resolvers import oc
from semver import VersionInfo

from .config import PluginConfig


class EnvTemplatedConfigLoader(TemplatedConfigLoader):
class EnvTemplatedConfigLoader(OmegaConfigLoader):
"""Config loader that can substitute $(commit_id) and $(branch_name)
placeholders with information taken from env variables."""

Expand All @@ -23,20 +24,25 @@ def __init__(
conf_source: str,
env: str = None,
runtime_params: Dict[str, Any] = None,
config_patterns: Dict[str, Any] = None,
*,
base_env: str = "base",
default_run_env: str = "local"
):
self.read_env()

super().__init__(
conf_source,
env=env,
runtime_params=runtime_params,
globals_dict=self.read_env(),
config_patterns=config_patterns,
base_env=base_env,
default_run_env=default_run_env,
custom_resolvers={"oc.env": oc.env},
)

def read_env(self) -> Dict:
@staticmethod
def read_env():
config = EnvTemplatedConfigLoader.ENV_DEFAULTS.copy()
overrides = dict(
[
Expand All @@ -46,7 +52,7 @@ def read_env(self) -> Dict:
]
)
config.update(**overrides)
return config
os.environ.update({k: v for k, v in config.items() if v is not None})


class ContextHelper(object):
Expand All @@ -59,7 +65,7 @@ def __init__(self, metadata, env):

@property
def project_name(self):
return self._metadata.project_name
return self._metadata.project_path.name

@property
@lru_cache()
Expand Down Expand Up @@ -108,7 +114,7 @@ class ContextHelper16(ContextHelper):

@property
def project_name(self):
return self.context.project_name
return self.context.project_path.name

@property
def context(self):
Expand Down
Loading
Loading