Skip to content

Commit 78da7cc

Browse files
committed
feat(kfp_sdk): pyproject.toml added.
Signed-off-by: CollinHowland <[email protected]>
1 parent 91b1b36 commit 78da7cc

File tree

4 files changed

+142
-107
lines changed

4 files changed

+142
-107
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ repos:
3838
- id: isort
3939
name: isort
4040
entry: isort --profile google
41-
- repo: https://github.com/pre-commit/mirrors-yapf
42-
rev: "v0.32.0"
41+
- repo: https://github.com/google/yapf
42+
rev: "v0.43.0"
4343
hooks:
4444
- id: yapf
4545
- repo: https://github.com/pycqa/docformatter

sdk/python/pyproject.toml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Copyright 2018-2022 The Kubeflow Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
[build-system]
16+
requires = ["setuptools>=61.0", "wheel"]
17+
build-backend = "setuptools.build_meta"
18+
19+
[project]
20+
name = "kfp"
21+
dynamic = ["version", "readme"]
22+
description = "Kubeflow Pipelines SDK"
23+
authors = [
24+
{name = "The Kubeflow Authors"}
25+
]
26+
requires-python = ">=3.9.0"
27+
classifiers = [
28+
'Intended Audience :: Developers',
29+
'Intended Audience :: Education',
30+
'Intended Audience :: Science/Research',
31+
'License :: OSI Approved :: Apache Software License',
32+
'Programming Language :: Python :: 3',
33+
'Programming Language :: Python :: 3.9',
34+
'Programming Language :: Python :: 3.10',
35+
'Programming Language :: Python :: 3.11',
36+
'Programming Language :: Python :: 3.12',
37+
'Programming Language :: Python :: 3.13',
38+
'Topic :: Scientific/Engineering',
39+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
40+
'Topic :: Software Development',
41+
'Topic :: Software Development :: Libraries',
42+
'Topic :: Software Development :: Libraries :: Python Modules',
43+
]
44+
dependencies = [
45+
# After any updates to these dependencies, requirements.txt should be regenerated running
46+
# the following in this folder:
47+
# pip-compile --no-emit-index-url requirements.in
48+
49+
"click==8.1.8",
50+
"click-option-group==0.5.7",
51+
"docstring-parser>=0.7.3,<1",
52+
# Pin google-api-core version for the bug fixing in 1.31.5",
53+
# https://github.com/googleapis/python-api-core/releases/tag/v1.31.5
54+
"google-api-core>=1.31.5,<3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
55+
"google-auth>=1.6.1,<3",
56+
# https://github.com/googleapis/python-storage/blob/main/CHANGELOG.md#221-2022-03-15
57+
"google-cloud-storage>=2.2.1,<4",
58+
# pin kfp-pipeline-spec to an exact version, since this is the contract between a given KFP
59+
# SDK version and the BE. we don't want old version of the SDK to write new fields and to
60+
# have the BE reject the new unsupported field (even if the new field backward compatible from a proto perspective)
61+
"kfp-pipeline-spec==2.14.0",
62+
# Update the upper version whenever a new major version of the
63+
# kfp-server-api package is released.
64+
# Update the lower version when kfp sdk depends on new apis/fields in
65+
# kfp-server-api
66+
"kfp-server-api>=2.14.0,<3",
67+
"kubernetes>=8.0.0,<31",
68+
# protobuf version should be identical to the one in kfp-pipeline-spec
69+
# api/v2alpha1/python/requirements.txt
70+
"protobuf==6.31.1,<7.0",
71+
"PyYAML>=5.3,<7",
72+
"requests-toolbelt>=0.8.0,<2",
73+
"tabulate>=0.8.6,<1",
74+
"urllib3<3.0.0",
75+
76+
## standard library backports ##
77+
"typing-extensions>=3.7.4,<5; python_version<'3.9'",
78+
]
79+
80+
[project.optional-dependencies]
81+
# TODO: needs to be dynamically set based on KFP version
82+
# kubernetes = [f'kfp-kubernetes==']
83+
kubernetes = ["kfp-kubernetes<2"]
84+
notebooks = ["nbclient>=0.10,<1", "ipykernel>=6,<7", "jupyter_client>=7,<9"]
85+
all = [
86+
"kfp[docker,kubernetes,notebooks]"
87+
]
88+
89+
[dependency-groups]
90+
dev = [
91+
"absl-py==1.4.0",
92+
"docformatter==1.4",
93+
"docker==5.0.3",
94+
"isort==5.10.1",
95+
"mypy==0.941",
96+
"pip-tools==6.0.0",
97+
"pre-commit==2.19.0",
98+
"pycln==2.1.1",
99+
"pylint==2.17.7",
100+
"pytest==7.1.2",
101+
"pytest-cov==3.0.0",
102+
"pytest-xdist==2.5.0",
103+
"types-protobuf==3.19.15",
104+
"types-PyYAML==6.0.5",
105+
"types-requests==2.27.14",
106+
"types-tabulate==0.8.6",
107+
"yapf==0.32.0",
108+
]
109+
110+
[project.urls]
111+
Documentation = 'https://kubeflow-pipelines.readthedocs.io/en/stable/'
112+
"Bug Tracker" = 'https://github.com/kubeflow/pipelines/issues'
113+
Source = 'https://github.com/kubeflow/pipelines/tree/master/sdk'
114+
Changelog = 'https://github.com/kubeflow/pipelines/blob/master/sdk/RELEASE.md'
115+
116+
[project.scripts]
117+
dsl-compile = "kfp.cli.compile_:main"
118+
kfp = "kfp.cli.__main__:main"
119+
120+
[tool.setuptools]
121+
include-package-data = true
122+
123+
[tool.setuptools.packages.find]
124+
exclude = ["*test*"]
125+
126+
[tool.setuptools.dynamic]
127+
version = {attr = "kfp.version.__version__"}
128+
readme = {file = "README.md", content-type = "text/markdown"}

sdk/python/requirements.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@ charset-normalizer==3.4.3
99
# via requests
1010
click==8.1.8
1111
# via
12-
# -r requirements.in
1312
# click-option-group
13+
# kfp (pyproject.toml)
1414
click-option-group==0.5.7
15-
# via -r requirements.in
15+
# via kfp (pyproject.toml)
16+
colorama==0.4.6
17+
# via click
1618
docstring-parser==0.17.0
1719
# via -r requirements.in
1820
google-api-core==2.26.0
1921
# via
20-
# -r requirements.in
2122
# google-cloud-core
2223
# google-cloud-storage
2324
google-auth==2.41.1
2425
# via
25-
# -r requirements.in
2626
# google-api-core
2727
# google-cloud-core
2828
# google-cloud-storage
29+
# kfp (pyproject.toml)
2930
# kubernetes
3031
google-cloud-core==2.4.3
3132
# via google-cloud-storage
@@ -46,7 +47,7 @@ kfp-pipeline-spec==2.14.6
4647
kfp-server-api>=2.14.3,<=2.14.7
4748
# via -r requirements.in
4849
kubernetes==30.1.0
49-
# via -r requirements.in
50+
# via kfp (pyproject.toml)
5051
oauthlib==3.3.1
5152
# via
5253
# kubernetes
@@ -55,9 +56,9 @@ proto-plus==1.26.1
5556
# via google-api-core
5657
protobuf==6.32.1
5758
# via
58-
# -r requirements.in
5959
# google-api-core
6060
# googleapis-common-protos
61+
# kfp (pyproject.toml)
6162
# kfp-pipeline-spec
6263
# proto-plus
6364
pyasn1==0.6.1
@@ -72,7 +73,7 @@ python-dateutil==2.9.0.post0
7273
# kubernetes
7374
pyyaml==6.0.3
7475
# via
75-
# -r requirements.in
76+
# kfp (pyproject.toml)
7677
# kubernetes
7778
requests==2.32.5
7879
# via
@@ -84,7 +85,7 @@ requests==2.32.5
8485
requests-oauthlib==2.0.0
8586
# via kubernetes
8687
requests-toolbelt==1.0.0
87-
# via -r requirements.in
88+
# via kfp (pyproject.toml)
8889
rsa==4.9.1
8990
# via google-auth
9091
six==1.17.0
@@ -93,10 +94,10 @@ six==1.17.0
9394
# kubernetes
9495
# python-dateutil
9596
tabulate==0.9.0
96-
# via -r requirements.in
97+
# via kfp (pyproject.toml)
9798
urllib3==2.5.0
9899
# via
99-
# -r requirements.in
100+
# kfp (pyproject.toml)
100101
# kfp-server-api
101102
# kubernetes
102103
# requests

sdk/python/setup.py

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -12,100 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
16-
import re
17-
from typing import List
18-
1915
import setuptools
2016

21-
22-
def get_requirements(requirements_file: str) -> List[str]:
23-
"""Read requirements from requirements.in."""
24-
25-
file_path = os.path.join(os.path.dirname(__file__), requirements_file)
26-
with open(file_path, 'r') as f:
27-
lines = f.readlines()
28-
lines = [line.strip() for line in lines]
29-
lines = [line for line in lines if not line.startswith('#') and line]
30-
return lines
31-
32-
33-
def find_version(*file_path_parts: str) -> str:
34-
"""Get version from kfp.__init__.__version__."""
35-
36-
file_path = os.path.join(os.path.dirname(__file__), *file_path_parts)
37-
with open(file_path, 'r') as f:
38-
version_file_text = f.read()
39-
40-
version_match = re.search(
41-
r"^__version__ = ['\"]([^'\"]*)['\"]",
42-
version_file_text,
43-
re.M,
44-
)
45-
if version_match:
46-
return version_match.group(1)
47-
48-
raise RuntimeError(f'Unable to find version string in file: {file_path}.')
49-
50-
51-
def read_readme() -> str:
52-
readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
53-
with open(readme_path) as f:
54-
return f.read()
55-
56-
57-
_version = find_version('kfp', 'version.py')
58-
docker = ['docker']
59-
kubernetes = [f'kfp-kubernetes=={_version}']
60-
notebooks = ["nbclient>=0.10,<1", "ipykernel>=6,<7", "jupyter_client>=7,<9"]
61-
62-
setuptools.setup(
63-
name='kfp',
64-
version=_version,
65-
description='Kubeflow Pipelines SDK',
66-
long_description=read_readme(),
67-
long_description_content_type='text/markdown',
68-
author='The Kubeflow Authors',
69-
url='https://github.com/kubeflow/pipelines',
70-
project_urls={
71-
'Documentation':
72-
'https://kubeflow-pipelines.readthedocs.io/en/stable/',
73-
'Bug Tracker':
74-
'https://github.com/kubeflow/pipelines/issues',
75-
'Source':
76-
'https://github.com/kubeflow/pipelines/tree/master/sdk',
77-
'Changelog':
78-
'https://github.com/kubeflow/pipelines/blob/master/sdk/RELEASE.md',
79-
},
80-
install_requires=get_requirements('requirements.in'),
81-
extras_require={
82-
'all': docker + kubernetes + notebooks,
83-
'kubernetes': kubernetes,
84-
'notebooks': notebooks,
85-
},
86-
packages=setuptools.find_packages(exclude=['*test*']),
87-
classifiers=[
88-
'Intended Audience :: Developers',
89-
'Intended Audience :: Education',
90-
'Intended Audience :: Science/Research',
91-
'License :: OSI Approved :: Apache Software License',
92-
'Programming Language :: Python :: 3',
93-
'Programming Language :: Python :: 3.9',
94-
'Programming Language :: Python :: 3.10',
95-
'Programming Language :: Python :: 3.11',
96-
'Programming Language :: Python :: 3.12',
97-
'Programming Language :: Python :: 3.13',
98-
'Topic :: Scientific/Engineering',
99-
'Topic :: Scientific/Engineering :: Artificial Intelligence',
100-
'Topic :: Software Development',
101-
'Topic :: Software Development :: Libraries',
102-
'Topic :: Software Development :: Libraries :: Python Modules',
103-
],
104-
python_requires='>=3.9.0',
105-
include_package_data=True,
106-
entry_points={
107-
'console_scripts': [
108-
'dsl-compile = kfp.cli.compile_:main',
109-
'kfp=kfp.cli.__main__:main',
110-
]
111-
})
17+
setuptools.setup()

0 commit comments

Comments
 (0)