Skip to content

Commit ab714a6

Browse files
committed
feat(kfp_sdk): pyproject.toml added.
1 parent 0c530df commit ab714a6

File tree

5 files changed

+143
-142
lines changed

5 files changed

+143
-142
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: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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+
kubernetes = ["kfp-kubernetes<2"]
82+
all = ["docker", "kfp-kubernetes<2"]
83+
84+
[dependency-groups]
85+
dev = [
86+
"absl-py==1.4.0",
87+
"docformatter==1.4",
88+
"docker==5.0.3",
89+
"isort==5.10.1",
90+
"mypy==0.941",
91+
"pip-tools==6.0.0",
92+
"pre-commit==2.19.0",
93+
"pycln==2.1.1",
94+
"pylint==2.17.7",
95+
"pytest==7.1.2",
96+
"pytest-cov==3.0.0",
97+
"pytest-xdist==2.5.0",
98+
"types-protobuf==3.19.15",
99+
"types-PyYAML==6.0.5",
100+
"types-requests==2.27.14",
101+
"types-tabulate==0.8.6",
102+
"yapf==0.32.0",
103+
]
104+
105+
[project.urls]
106+
Documentation = 'https://kubeflow-pipelines.readthedocs.io/en/stable/'
107+
"Bug Tracker" = 'https://github.com/kubeflow/pipelines/issues'
108+
Source = 'https://github.com/kubeflow/pipelines/tree/master/sdk'
109+
Changelog = 'https://github.com/kubeflow/pipelines/blob/master/sdk/RELEASE.md'
110+
111+
[project.scripts]
112+
dsl-compile = "kfp.cli.compile_:main"
113+
kfp = "kfp.cli.__main__:main"
114+
115+
[tool.setuptools]
116+
include-package-data = true
117+
118+
[tool.setuptools.packages.find]
119+
exclude = ["*test*"]
120+
121+
[tool.setuptools.dynamic]
122+
version = {attr = "kfp.version.__version__"}
123+
readme = {file = "README.md", content-type = "text/markdown"}

sdk/python/requirements.in

Lines changed: 0 additions & 33 deletions
This file was deleted.

sdk/python/requirements.txt

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile with Python 3.13
33
# by the following command:
44
#
5-
# pip-compile --no-emit-index-url requirements.in
5+
# pip-compile --no-emit-index-url pyproject.toml
66
#
77
cachetools==5.5.2
88
# via google-auth
@@ -15,28 +15,30 @@ charset-normalizer==3.4.2
1515
# via requests
1616
click==8.1.8
1717
# via
18-
# -r requirements.in
1918
# click-option-group
19+
# kfp (pyproject.toml)
2020
click-option-group==0.5.7
21-
# via -r requirements.in
21+
# via kfp (pyproject.toml)
22+
colorama==0.4.6
23+
# via click
2224
docstring-parser==0.17.0
23-
# via -r requirements.in
25+
# via kfp (pyproject.toml)
2426
google-api-core==2.25.1
2527
# via
26-
# -r requirements.in
2728
# google-cloud-core
2829
# google-cloud-storage
30+
# kfp (pyproject.toml)
2931
google-auth==2.40.3
3032
# via
31-
# -r requirements.in
3233
# google-api-core
3334
# google-cloud-core
3435
# google-cloud-storage
36+
# kfp (pyproject.toml)
3537
# kubernetes
3638
google-cloud-core==2.4.3
3739
# via google-cloud-storage
3840
google-cloud-storage==3.2.0
39-
# via -r requirements.in
41+
# via kfp (pyproject.toml)
4042
google-crc32c==1.7.1
4143
# via
4244
# google-cloud-storage
@@ -48,11 +50,11 @@ googleapis-common-protos==1.70.0
4850
idna==3.10
4951
# via requests
5052
kfp-pipeline-spec==2.14.0
51-
# via -r requirements.in
53+
# via kfp (pyproject.toml)
5254
kfp-server-api==2.14.0
53-
# via -r requirements.in
55+
# via kfp (pyproject.toml)
5456
kubernetes==30.1.0
55-
# via -r requirements.in
57+
# via kfp (pyproject.toml)
5658
oauthlib==3.3.1
5759
# via
5860
# kubernetes
@@ -61,9 +63,9 @@ proto-plus==1.26.1
6163
# via google-api-core
6264
protobuf==6.31.1
6365
# via
64-
# -r requirements.in
6566
# google-api-core
6667
# googleapis-common-protos
68+
# kfp (pyproject.toml)
6769
# kfp-pipeline-spec
6870
# proto-plus
6971
pyasn1==0.6.1
@@ -78,7 +80,7 @@ python-dateutil==2.9.0.post0
7880
# kubernetes
7981
pyyaml==6.0.2
8082
# via
81-
# -r requirements.in
83+
# kfp (pyproject.toml)
8284
# kubernetes
8385
requests==2.32.4
8486
# via
@@ -90,7 +92,7 @@ requests==2.32.4
9092
requests-oauthlib==2.0.0
9193
# via kubernetes
9294
requests-toolbelt==1.0.0
93-
# via -r requirements.in
95+
# via kfp (pyproject.toml)
9496
rsa==4.9.1
9597
# via google-auth
9698
six==1.17.0
@@ -99,10 +101,10 @@ six==1.17.0
99101
# kubernetes
100102
# python-dateutil
101103
tabulate==0.9.0
102-
# via -r requirements.in
104+
# via kfp (pyproject.toml)
103105
urllib3==2.5.0
104106
# via
105-
# -r requirements.in
107+
# kfp (pyproject.toml)
106108
# kfp-server-api
107109
# kubernetes
108110
# requests

sdk/python/setup.py

Lines changed: 1 addition & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -12,97 +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-
docker = ['docker']
58-
kubernetes = ['kfp-kubernetes<2']
59-
60-
setuptools.setup(
61-
name='kfp',
62-
version=find_version('kfp', 'version.py'),
63-
description='Kubeflow Pipelines SDK',
64-
long_description=read_readme(),
65-
long_description_content_type='text/markdown',
66-
author='The Kubeflow Authors',
67-
url='https://github.com/kubeflow/pipelines',
68-
project_urls={
69-
'Documentation':
70-
'https://kubeflow-pipelines.readthedocs.io/en/stable/',
71-
'Bug Tracker':
72-
'https://github.com/kubeflow/pipelines/issues',
73-
'Source':
74-
'https://github.com/kubeflow/pipelines/tree/master/sdk',
75-
'Changelog':
76-
'https://github.com/kubeflow/pipelines/blob/master/sdk/RELEASE.md',
77-
},
78-
install_requires=get_requirements('requirements.in'),
79-
extras_require={
80-
'all': docker + kubernetes,
81-
'kubernetes': kubernetes,
82-
},
83-
packages=setuptools.find_packages(exclude=['*test*']),
84-
classifiers=[
85-
'Intended Audience :: Developers',
86-
'Intended Audience :: Education',
87-
'Intended Audience :: Science/Research',
88-
'License :: OSI Approved :: Apache Software License',
89-
'Programming Language :: Python :: 3',
90-
'Programming Language :: Python :: 3.9',
91-
'Programming Language :: Python :: 3.10',
92-
'Programming Language :: Python :: 3.11',
93-
'Programming Language :: Python :: 3.12',
94-
'Programming Language :: Python :: 3.13',
95-
'Topic :: Scientific/Engineering',
96-
'Topic :: Scientific/Engineering :: Artificial Intelligence',
97-
'Topic :: Software Development',
98-
'Topic :: Software Development :: Libraries',
99-
'Topic :: Software Development :: Libraries :: Python Modules',
100-
],
101-
python_requires='>=3.9.0',
102-
include_package_data=True,
103-
entry_points={
104-
'console_scripts': [
105-
'dsl-compile = kfp.cli.compile_:main',
106-
'kfp=kfp.cli.__main__:main',
107-
]
108-
})
17+
setuptools.setup()

0 commit comments

Comments
 (0)