Skip to content
Closed
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
22 changes: 10 additions & 12 deletions sdk/python/kfp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,30 @@

# `kfp` is a namespace package.
# https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages

__path__ = __import__('pkgutil').extend_path(__path__, __name__)

try:
from .version import __version__
except ImportError:
__version__ = 'dev'
__version__ = "0.0.0+dev"
Comment on lines -22 to +23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed.


import sys
import warnings

if sys.version_info < (3, 9):
warnings.warn(
('KFP will drop support for Python 3.9 on Oct 1, 2025. To use new versions of the KFP SDK after that date, you will need to upgrade to Python >= 3.10. See https://devguide.python.org/versions/ for more details.'
(
'KFP will drop support for Python 3.9 on Oct 1, 2025. '
'To use new versions of the KFP SDK after that date, you will need to upgrade to Python >= 3.10.'
),
FutureWarning,
stacklevel=2,
)

TYPE_CHECK = True

import os

# compile-time only dependencies
if os.environ.get('_KFP_RUNTIME', 'false') != 'true':
# make `from kfp import components` and `from kfp import dsl` valid;
# related to namespace packaging issue
from kfp import components # noqa: keep unused import
from kfp import dsl # noqa: keep unused import
from kfp.client import Client # noqa: keep unused import
from kfp import components # noqa
from kfp import dsl # noqa
from kfp.client import Client # noqa
from . import version
from .version import __version__ # make top-level __version__ available
10 changes: 8 additions & 2 deletions sdk/python/kfp/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
from kfp.cli import run
from kfp.cli.output import OutputFormat
from kfp.cli.utils import aliased_plurals_group
from kfp.cli.utils import parsing
from kfp.cli.utils import parsing
from kfp import version as _version


COMMANDS = {
'client': {
Expand Down Expand Up @@ -93,9 +95,13 @@ def _install_completion(shell: str) -> None:
type=click.Choice(list(map(lambda x: x.name, OutputFormat))),
default=OutputFormat.table.name,
show_default=True,
help='The formatting style for command output.')
help='The formatting style for command output.'
)
@click.pass_context
@click.version_option(version=kfp.__version__, message='%(prog)s %(version)s')



def cli(ctx: click.Context, endpoint: str, iap_client_id: str, namespace: str,
other_client_id: str, other_client_secret: str, existing_token: str,
output: OutputFormat, show_completion: str, install_completion: str):
Expand Down
3 changes: 1 addition & 2 deletions sdk/python/kfp/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
]

from kfp.client.client import Client
from kfp.client.set_volume_credentials import \
ServiceAccountTokenVolumeCredentials
from kfp.client.set_volume_credentials import ServiceAccountTokenVolumeCredentials
from kfp.client.token_credentials_base import TokenCredentialsBase

KF_PIPELINES_SA_TOKEN_ENV = 'KF_PIPELINES_SA_TOKEN_PATH'
Expand Down
12 changes: 10 additions & 2 deletions sdk/python/kfp/compiler/pipeline_spec_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@
import copy
import json
import typing
from typing import (Any, DefaultDict, Dict, List, Mapping, Optional, Tuple,
Union)
from typing import (
Any,
DefaultDict,
Dict,
List,
Mapping,
Optional,
Tuple,
Union,
)
import warnings

from google.protobuf import json_format
Expand Down
49 changes: 33 additions & 16 deletions sdk/python/kfp/dsl/component_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,51 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.

import dataclasses
import inspect
import itertools
import pathlib
import re
import textwrap
from typing import (Any, Callable, Dict, List, Mapping, Optional, Tuple, Type,
Union)
import warnings
from typing import (
Any,
Callable,
Dict,
List,
Mapping,
Optional,
Tuple,
Type,
Union,
)

import docstring_parser
import kfp
from kfp import dsl
from kfp.dsl import container_component_artifact_channel
from kfp.dsl import container_component_class
from kfp.dsl import graph_component
from kfp.dsl import pipeline_config
from kfp.dsl import placeholders
from kfp.dsl import python_component
from kfp.dsl import structures
from kfp.dsl import task_final_status
from kfp.dsl import (
container_component_artifact_channel,
container_component_class,
graph_component,
pipeline_config,
placeholders,
python_component,
structures,
task_final_status,
)

from kfp.dsl.component_task_config import TaskConfigPassthrough
from kfp.dsl.container_component_artifact_channel import (
ContainerComponentArtifactChannel,
)
from kfp.dsl.task_config import TaskConfig
from kfp.dsl.types import artifact_types
from kfp.dsl.types import custom_artifact_types
from kfp.dsl.types import type_annotations
from kfp.dsl.types import type_utils
from kfp.dsl.types import (
artifact_types,
custom_artifact_types,
type_annotations,
type_utils,
)

_DEFAULT_BASE_IMAGE = 'python:3.9'
SINGLE_OUTPUT_NAME = 'Output'
Expand Down
3 changes: 1 addition & 2 deletions sdk/python/kfp/dsl/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from kfp.dsl import utils
from kfp.dsl import v1_structures
from kfp.dsl.component_task_config import TaskConfigPassthrough
from kfp.dsl.container_component_artifact_channel import \
ContainerComponentArtifactChannel
from kfp.dsl.container_component_artifact_channel import ContainerComponentArtifactChannel
from kfp.dsl.task_config import TaskConfig
from kfp.dsl.types import artifact_types
from kfp.dsl.types import type_annotations
Expand Down
1 change: 0 additions & 1 deletion sdk/python/kfp/dsl/v1_modelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

T = TypeVar('T')


def verify_object_against_type(x: Any, typ: Type[T]) -> T:
"""Verifies that the object is compatible to the specified type (types from
the typing package can be used)."""
Expand Down
3 changes: 2 additions & 1 deletion sdk/python/kfp/version.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = '2.14.2'
__version__ = "2.14.2"

Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ deploymentSpec:

printf "%s" "$0" > "$program_path/ephemeral_component.py"

_KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"
python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"

'
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\
Expand Down Expand Up @@ -118,7 +118,7 @@ deploymentSpec:

printf "%s" "$0" > "$program_path/ephemeral_component.py"

_KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"
python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"

'
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\
Expand Down Expand Up @@ -147,7 +147,7 @@ deploymentSpec:

printf "%s" "$0" > "$program_path/ephemeral_component.py"

_KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"
python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"

'
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\
Expand Down Expand Up @@ -176,7 +176,7 @@ deploymentSpec:

printf "%s" "$0" > "$program_path/ephemeral_component.py"

_KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"
python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"

'
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\
Expand Down