Skip to content

Commit

Permalink
respond to review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-mccarthy committed Aug 22, 2023
1 parent 1a76d94 commit e55885f
Show file tree
Hide file tree
Showing 52 changed files with 143 additions and 156 deletions.
2 changes: 1 addition & 1 deletion sdk/python/kfp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import os

# compile-time only dependencies
if os.environ.get('_RUNTIME', 'false') != 'true':
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
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/kfp/dsl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def my_pipeline():
"""

# compile-time only dependencies
if os.environ.get('_RUNTIME', 'false') != 'true':
if os.environ.get('_KFP_RUNTIME', 'false') != 'true':
from kfp.dsl.component_decorator import component
from kfp.dsl.container_component_decorator import container_component
from kfp.dsl.for_loop import Collected
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/kfp/dsl/component_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def make_index_url_options(pip_index_urls: Optional[List[str]]) -> str:
python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip
fi
PIP_DISABLE_PIP_VERSION_CHECK=1 _RUNTIME=true python3 -m pip install --quiet \
PIP_DISABLE_PIP_VERSION_CHECK=1 _KFP_RUNTIME=true python3 -m pip install --quiet \
--no-warn-script-location {index_url_options}{concat_package_list} && "$0" "$@"
'''

Expand Down
10 changes: 5 additions & 5 deletions sdk/python/kfp/dsl/component_factory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_with_no_user_packages_to_install(self):

self.assertEqual(command, [
'sh', '-c',
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'kfp==2.1.2\' \'--no-deps\' \'typing-extensions>=3.7.4,<5; python_version<"3.9"\' && "$0" "$@"\n'
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'kfp==2.1.2\' \'--no-deps\' \'typing-extensions>=3.7.4,<5; python_version<"3.9"\' && "$0" "$@"\n'
])

def test_with_no_user_packages_to_install_and_install_kfp_false(self):
Expand All @@ -58,7 +58,7 @@ def test_with_no_user_packages_to_install_and_kfp_package_path(self):

self.assertEqual(command, [
'sh', '-c',
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'git+https://github.com/kubeflow/pipelines.git@master#subdirectory=sdk/python\' && "$0" "$@"\n'
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'git+https://github.com/kubeflow/pipelines.git@master#subdirectory=sdk/python\' && "$0" "$@"\n'
])

def test_with_no_user_packages_to_install_and_kfp_package_path_and_install_kfp_false(
Expand All @@ -84,7 +84,7 @@ def test_with_user_packages_to_install_and_kfp_package_path_and_install_kfp_fals

self.assertEqual(command, [
'sh', '-c',
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'sklearn\' && "$0" "$@"\n'
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'sklearn\' && "$0" "$@"\n'
])

def test_with_no_user_packages_to_install_and_kfp_package_path_and_target_image(
Expand Down Expand Up @@ -118,7 +118,7 @@ def test_with_user_packages_to_install_and_no_pip_index_url(self):

self.assertEqual(command, [
'sh', '-c',
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'package1\' \'package2\' \'kfp==2.1.2\' \'--no-deps\' \'typing-extensions>=3.7.4,<5; python_version<"3.9"\' && "$0" "$@"\n'
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location \'package1\' \'package2\' \'kfp==2.1.2\' \'--no-deps\' \'typing-extensions>=3.7.4,<5; python_version<"3.9"\' && "$0" "$@"\n'
])

def test_with_packages_to_install_with_pip_index_url(self):
Expand All @@ -132,7 +132,7 @@ def test_with_packages_to_install_with_pip_index_url(self):

self.assertEqual(command, [
'sh', '-c',
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location --index-url https://myurl.org/simple --trusted-host https://myurl.org/simple \'package1\' \'package2\' \'kfp==2.1.2\' \'--no-deps\' \'typing-extensions>=3.7.4,<5; python_version<"3.9"\' && "$0" "$@"\n'
'\nif ! [ -x "$(command -v pip)" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location --index-url https://myurl.org/simple --trusted-host https://myurl.org/simple \'package1\' \'package2\' \'kfp==2.1.2\' \'--no-deps\' \'typing-extensions>=3.7.4,<5; python_version<"3.9"\' && "$0" "$@"\n'
])


Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/add_numbers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ --index-url https://pypi.org/simple --trusted-host https://pypi.org/simple\
\ 'yapf' 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/concat_message.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/dict_input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/identity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/input_artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/nested_return.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/output_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/test_data/components/preprocess.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ --index-url https://pypi.org/simple --trusted-host https://pypi.org/simple\
\ 'yapf' 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down Expand Up @@ -156,7 +156,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down Expand Up @@ -131,7 +131,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down Expand Up @@ -109,7 +109,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down Expand Up @@ -137,7 +137,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down Expand Up @@ -165,7 +165,7 @@ deploymentSpec:
- -c
- "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ _RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ _KFP_RUNTIME=true python3 -m pip install --quiet --no-warn-script-location\
\ 'kfp==2.1.2' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\
3.9\"' && \"$0\" \"$@\"\n"
- sh
Expand Down
Loading

0 comments on commit e55885f

Please sign in to comment.