|
1 | | -# Copyright 2023 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 | | -import os |
16 | | -import re |
17 | | -from typing import List |
18 | | - |
19 | 1 | import setuptools |
20 | 2 |
|
21 | | -NAME = 'kfp-kubernetes' |
22 | | - |
23 | | -def get_requirements(requirements_file: str) -> List[str]: |
24 | | - """Read requirements from requirements.in.""" |
25 | | - |
26 | | - file_path = os.path.join(os.path.dirname(__file__), requirements_file) |
27 | | - with open(file_path, 'r') as f: |
28 | | - lines = f.readlines() |
29 | | - lines = [line.strip() for line in lines] |
30 | | - lines = [line for line in lines if not line.startswith('#') and line] |
31 | | - return lines |
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[1] |
47 | | - else: |
48 | | - raise ValueError('Could not find version.') |
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 | | -setuptools.setup( |
58 | | - name=NAME, |
59 | | - version=find_version('kfp', 'kubernetes', '__init__.py'), |
60 | | - description='Kubernetes platform configuration library and generated protos.', |
61 | | - long_description=read_readme(), |
62 | | - long_description_content_type='text/markdown', |
63 | | - author='google', |
64 | | - |
65 | | - url='https://github.com/kubeflow/pipelines', |
66 | | - project_urls={ |
67 | | - 'Documentation': |
68 | | - 'https://kfp-kubernetes.readthedocs.io/', |
69 | | - 'Bug Tracker': |
70 | | - 'https://github.com/kubeflow/pipelines/issues', |
71 | | - 'Source': |
72 | | - 'https://github.com/kubeflow/pipelines/tree/master/kubernetes_platform/python', |
73 | | - }, |
74 | | - packages=setuptools.find_namespace_packages(include=['kfp.*']), |
75 | | - python_requires='>=3.9.0', |
76 | | - install_requires=get_requirements('requirements.in'), |
77 | | - include_package_data=True, |
78 | | - extras_require={ |
79 | | - 'dev': get_requirements('requirements-dev.txt'), |
80 | | - }, |
81 | | - license='Apache 2.0', |
82 | | -) |
| 3 | +setuptools.setup() |
0 commit comments