Skip to content

Commit

Permalink
Merge pull request #59 from getindata/release-0.5.0
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
em-pe authored Jul 13, 2022
2 parents 0624574 + 55498b2 commit f08792b
Show file tree
Hide file tree
Showing 20 changed files with 336 additions and 168 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
open-pull-requests-limit: 10
ignore:
- dependency-name: protobuf
versions: ["3.x", "4.x"]
72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "develop", master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "develop" ]
schedule:
- cron: '23 17 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
3 changes: 2 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ jobs:
source venv/bin/activate
- name: Initialize kedro spaceflights project
# kedro 0.18.1 is on purpose here, due to https://github.com/kedro-org/kedro-starters/issues/99
run: |
pip install . 'kedro<0.18'
pip install . 'kedro==0.18.1'
kedro new --starter spaceflights --config tests/e2e/starter-config.yml --verbose
- name: Install project dependencies
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2

- name: Setup python
- name: Setup python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}

- name: Setup virtualenv
run: |
Expand All @@ -32,10 +36,11 @@ jobs:
- name: Test with tox
run: |
pip install tox-pip-version
tox -v -e py38
pip install tox-pip-version tox-gh-actions
tox -v
- name: Report coverage
if: ${{ matrix.python-version }} == "3.10"
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE }}
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [0.5.0] - 2022-07-13

- Add support for `kedro>=0.18.1,<0.19` (#36)
- Dependency update `kfp==0.18.1` (#45)
- Added tests and support for python 3.9 and 3.10 (#37)

## [0.4.1] - 2022-04-14

- Add missing `initialize-job` for `mlflow-start-run` step, added MLFlowGoogleIAMCredentialsProvider.
Expand All @@ -28,7 +34,9 @@

- Initial version of **kedro-vertexai** plugin extracted from [kedro-kubeflow v0.6.0](https://github.com/getindata/kedro-kubeflow/tree/0.6.0)

[Unreleased]: https://github.com/getindata/kedro-vertexai/compare/0.4.1...HEAD
[Unreleased]: https://github.com/getindata/kedro-vertexai/compare/0.5.0...HEAD

[0.5.0]: https://github.com/getindata/kedro-vertexai/compare/0.4.1...0.5.0

[0.4.1]: https://github.com/getindata/kedro-vertexai/compare/0.4.0...0.4.1

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Kedro Vertex AI Plugin

[![Python Version](https://img.shields.io/badge/python-3.8-blue.svg)](https://github.com/getindata/kedro-vertexai)
[![Python Version](https://img.shields.io/pypi/pyversions/kedro-vertexai)](https://github.com/getindata/kedro-vertexai)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![SemVer](https://img.shields.io/badge/semver-2.0.0-green)](https://semver.org/)
[![PyPI version](https://badge.fury.io/py/kedro-vertexai.svg)](https://pypi.org/project/kedro-vertexai/)
Expand Down Expand Up @@ -34,15 +34,14 @@ Options:
-h, --help Show this message and exit.
Commands:
compile Translates Kedro pipeline into YAML file with Kubeflow...
compile Translates Kedro pipeline into JSON file with Kubeflow...
init Initializes configuration for the plugin
list-pipelines List deployed pipeline definitions
run-once Deploy pipeline as a single run within given experiment.
schedule Schedules recurring execution of latest version of the...
ui Open VertexAI Pipelines UI in new browser tab
```

## Configuration file

`kedro init` generates configuration file for the plugin, but users may want to adjust it to match the run environment
requirements. Check documentation for details - [kedro-kubeflow.readthedocs.io](https://kedro-kubeflow.readthedocs.io/en/latest/source/02_installation/02_configuration.html)
requirements. Check documentation for details - [kedro-vertexai.readthedocs.io](https://kedro-vertexai.readthedocs.io/en/latest/source/02_installation/02_configuration.html)
2 changes: 1 addition & 1 deletion docs/source/02_installation/01_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
First, you need to install base Kedro package

```console
$ pip install "kedro>=0.16,<=0.18"
$ pip install "kedro>=0.18.1,<0.19.0"
```

## Plugin installation
Expand Down
2 changes: 1 addition & 1 deletion docs/source/03_getting_started/01_quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ source venv-demo/bin/activate
Then, `kedro` must be present to enable cloning the starter project, along with the latest version of `kedro-kubeflow` plugina and kedro-docker (required to build docker images with the Kedro pipeline nodes):

```
$ pip install 'kedro<0.18' kedro-vertexai kedro-docker
$ pip install 'kedro>=0.18.1,<0.19.0' kedro-vertexai kedro-docker
```

With the dependencies in place, let's create a new project:
Expand Down
2 changes: 1 addition & 1 deletion kedro_vertexai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""kedro_vertexai."""

version = "0.4.1"
version = "0.5.0"
11 changes: 3 additions & 8 deletions kedro_vertexai/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path

import click
from click import Context
from click import ClickException, Context

from .client import VertexAIPipelinesClient
from .config import PluginConfig
Expand Down Expand Up @@ -252,17 +252,12 @@ def init(ctx, project_id, region, with_github_actions: bool):
@click.pass_context
def mlflow_start(ctx, run_id: str, output: str):
import mlflow
from kedro_mlflow.framework.context import get_mlflow_config

try:
kedro_context = ctx.obj["context_helper"].context
mlflow_conf = get_mlflow_config(kedro_context)
mlflow_conf.setup(kedro_context)
mlflow_conf = kedro_context.mlflow
except AttributeError:
kedro_session = ctx.obj["context_helper"].session
with kedro_session:
mlflow_conf = get_mlflow_config(kedro_session)
mlflow_conf.setup()
raise ClickException("Could not read MLFlow config")

run = mlflow.start_run(
experiment_id=mlflow_conf.experiment.experiment_id, nested=False
Expand Down
20 changes: 16 additions & 4 deletions kedro_vertexai/context_helper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from functools import lru_cache
from typing import Dict, Iterable
from typing import Any, Dict

from kedro.config import TemplatedConfigLoader

Expand All @@ -18,11 +18,23 @@ class EnvTemplatedConfigLoader(TemplatedConfigLoader):
# defaults provided so default variables ${commit_id|dirty} work for some entries
ENV_DEFAULTS = {"commit_id": None, "branch_name": None, "run_id": ""}

def __init__(self, conf_paths: Iterable[str]):
def __init__(
self,
conf_source: str,
env: str = None,
runtime_params: Dict[str, Any] = None,
*,
base_env: str = "base",
default_run_env: str = "local"
):
super().__init__(
conf_paths,
conf_source,
env=env,
runtime_params=runtime_params,
globals_dict=self.read_env(),
globals_pattern=os.getenv(KEDRO_GLOBALS_PATTERN, None),
base_env=base_env,
default_run_env=default_run_env,
)

def read_env(self) -> Dict:
Expand Down Expand Up @@ -63,7 +75,7 @@ def context(self):
@lru_cache()
def config(self) -> PluginConfig:
raw = EnvTemplatedConfigLoader(
self.context.config_loader.conf_paths
self.context.config_loader.conf_source
).get(self.CONFIG_FILE_PATTERN)
return PluginConfig.parse_obj(raw)

Expand Down
11 changes: 6 additions & 5 deletions kedro_vertexai/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Dict, Set

import kfp
from kedro.framework.context import KedroContext
from kedro.pipeline.node import Node
from kfp.components.structures import (
ComponentSpec,
Expand Down Expand Up @@ -41,15 +42,15 @@ def __init__(self, config, project_name, context, run_name: str):
assert run_name, "run_name cannot be empty / None"
self.run_name = run_name
self.project_name = project_name
self.context = context
self.context: KedroContext = context
self.run_config: RunConfig = config.run_config
self.catalog = context.config_loader.get("catalog*")

def get_pipeline_name(self):
"""
Returns Vertex-compatible pipeline name
"""
return self.project_name.lower().replace(" ", "-")
return self.project_name.lower().replace(" ", "-").replace("_", "-")

def generate_pipeline(self, pipeline, image, image_pull_policy, token):
"""
Expand All @@ -73,9 +74,9 @@ def set_dependencies(node, dependencies, kfp_ops):
description=self.run_config.description,
)
def convert_kedro_pipeline_to_kfp() -> None:
node_dependencies = self.context.pipelines.get(
pipeline
).node_dependencies
from kedro.framework.project import pipelines

node_dependencies = pipelines[pipeline].node_dependencies
kfp_ops = self._build_kfp_ops(
node_dependencies, image, pipeline, token
)
Expand Down
4 changes: 2 additions & 2 deletions kedro_vertexai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def clean_name(name: str) -> str:

def is_mlflow_enabled() -> bool:
try:
import kedro_mlflow # NOQA
import mlflow # NOQA
from kedro_mlflow.framework.context import get_mlflow_config # NOQA

return True
except ImportError:
Expand Down Expand Up @@ -77,7 +77,7 @@ def _generate_and_save_dynamic_config(
dynamic_config = provider.generate_config()
target_path = (
context_helper.context.project_path
/ settings.CONF_ROOT
/ settings.CONF_SOURCE
/ provider.target_env
/ provider.target_config_file
)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.1
current_version = 0.5.0

[bumpversion:file:setup.py]

Expand Down
Loading

0 comments on commit f08792b

Please sign in to comment.