xflow.framework 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xflow/framework/__init__.py +0 -0
- xflow/framework/common.py +14 -0
- xflow/framework/container.py +292 -0
- xflow/framework/env.py +72 -0
- xflow/framework/errors.py +33 -0
- xflow/framework/main.py +112 -0
- xflow/framework/node.py +392 -0
- xflow/framework/pipeline.py +189 -0
- xflow/framework/ssh.py +372 -0
- xflow/framework/statics/initdir/.gitignore +215 -0
- xflow/framework/statics/initdir/README.md +0 -0
- xflow/framework/statics/initdir/env.yml +41 -0
- xflow/framework/statics/initdir/pipelines/__init__.py +0 -0
- xflow/framework/statics/initdir/pipelines/example.py +60 -0
- xflow/framework/statics/initdir/pipelines/template.py +32 -0
- xflow/framework/statics/initdir/requirements.txt +1 -0
- xflow/framework/statics/initdir/scripts/.gitkeep +0 -0
- xflow/framework/statics/initdir/workdir/.gitkeep +0 -0
- xflow/framework/utils.py +59 -0
- xflow/framework/version.py +4 -0
- xflow_framework-0.1.0.dist-info/METADATA +43 -0
- xflow_framework-0.1.0.dist-info/RECORD +26 -0
- xflow_framework-0.1.0.dist-info/WHEEL +5 -0
- xflow_framework-0.1.0.dist-info/entry_points.txt +2 -0
- xflow_framework-0.1.0.dist-info/licenses/LICENSE +24 -0
- xflow_framework-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from xflow.framework.pipeline import Pipeline
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class template(Pipeline):
|
|
5
|
+
"""
|
|
6
|
+
pipeline 模版。
|
|
7
|
+
"""
|
|
8
|
+
class Options(Pipeline.Options):
|
|
9
|
+
"""
|
|
10
|
+
流水线参数表,根据需要自行定义。
|
|
11
|
+
"""
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
def setup(self) -> None:
|
|
15
|
+
"""
|
|
16
|
+
前置步骤。
|
|
17
|
+
"""
|
|
18
|
+
self.options: __class__.Options # 保留用于自动提示
|
|
19
|
+
super().setup()
|
|
20
|
+
|
|
21
|
+
def stage1(self) -> None:
|
|
22
|
+
"""
|
|
23
|
+
阶段 1。
|
|
24
|
+
每个 Pipeline 至少 1 个阶段,然后根据需要继续添加,命名为 stage2, stage3, ...。
|
|
25
|
+
"""
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
def teardown(self) -> None:
|
|
29
|
+
"""
|
|
30
|
+
后置步骤。
|
|
31
|
+
"""
|
|
32
|
+
super().teardown()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xflow.framework; python_version >= '3.10'
|
|
File without changes
|
|
File without changes
|
xflow/framework/utils.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Copyright (c) 2025-2026, zhaowcheng <zhaowcheng@163.com>
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
实用函数。
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import re
|
|
8
|
+
import string
|
|
9
|
+
import functools
|
|
10
|
+
|
|
11
|
+
from typing import Callable, Any, TypeVar
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
T = TypeVar('T')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def remove_ansi_escape_chars(s: str) -> str:
|
|
18
|
+
"""
|
|
19
|
+
移除 `s` 中的 ANSI 转义字符。
|
|
20
|
+
|
|
21
|
+
>>> remove_ansi_escape_chars('\x1b[31mhello\x1b[0m')
|
|
22
|
+
'hello'
|
|
23
|
+
"""
|
|
24
|
+
escapes = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
|
25
|
+
return escapes.sub('', s)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def remove_unprintable_chars(s: str) -> str:
|
|
29
|
+
"""
|
|
30
|
+
移除 `s` 中的不可打印字符。
|
|
31
|
+
|
|
32
|
+
>>> remove_unprintable_chars('hello\xe9')
|
|
33
|
+
'hello'
|
|
34
|
+
"""
|
|
35
|
+
return ''.join(c for c in s if c in string.printable)
|
|
36
|
+
|
|
37
|
+
def copy_signature(f: T) -> Callable[[Any], T]:
|
|
38
|
+
"""
|
|
39
|
+
拷贝函数签名。
|
|
40
|
+
|
|
41
|
+
示例:
|
|
42
|
+
class Child(Parent):
|
|
43
|
+
@copy_signature(Parent.__init__)
|
|
44
|
+
def __init(self, *args, **kwargs):
|
|
45
|
+
...
|
|
46
|
+
"""
|
|
47
|
+
def decorator(func):
|
|
48
|
+
@functools.wraps(f)
|
|
49
|
+
def wrapper(*args, **kwargs):
|
|
50
|
+
return func(*args, **kwargs)
|
|
51
|
+
return wrapper
|
|
52
|
+
return decorator
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def isclass(obj: Any) -> bool:
|
|
56
|
+
"""
|
|
57
|
+
判断一个对象是否为 class。
|
|
58
|
+
"""
|
|
59
|
+
return isinstance(obj, type)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xflow.framework
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 可以用 Python 写 Pipeline 的 CICD 框架。
|
|
5
|
+
Home-page: https://github.com/zhaowcheng/xflow.framework
|
|
6
|
+
Author: zhaowcheng
|
|
7
|
+
Author-email: zhaowcheng@163.com
|
|
8
|
+
Project-URL: Homepage, https://github.com/zhaowcheng/xflow.framework
|
|
9
|
+
Project-URL: Issues, https://github.com/zhaowcheng/xflow.framework/issues
|
|
10
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.6
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: ruamel.yaml; python_version >= "3.10"
|
|
24
|
+
Requires-Dist: paramiko; python_version >= "3.10"
|
|
25
|
+
Requires-Dist: decorator; python_version >= "3.10"
|
|
26
|
+
Requires-Dist: filelock; python_version >= "3.10"
|
|
27
|
+
Requires-Dist: docker; python_version >= "3.10"
|
|
28
|
+
Requires-Dist: typed-settings[click,option-groups,pydantic]; python_version >= "3.10"
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: author-email
|
|
31
|
+
Dynamic: classifier
|
|
32
|
+
Dynamic: description
|
|
33
|
+
Dynamic: description-content-type
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
Dynamic: project-url
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: requires-python
|
|
39
|
+
Dynamic: summary
|
|
40
|
+
|
|
41
|
+
# xflow.framework
|
|
42
|
+
|
|
43
|
+
可以用 Python 写 Pipeline 的 CICD 框架。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
xflow/framework/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
xflow/framework/common.py,sha256=RBBGbrt5EPor7vqCzAHpiPRq-sVmUu13j8jS4BK-RE8,248
|
|
3
|
+
xflow/framework/container.py,sha256=PEMcive1lmKvvK5T1vEZpHgmkYQYgFIntfOfFJpIDe0,9917
|
|
4
|
+
xflow/framework/env.py,sha256=hRH0LLsgWin7z2M8-1Q2pLrmJXEmssLx62MRH3IMhbc,2570
|
|
5
|
+
xflow/framework/errors.py,sha256=xRP_tQHppTNreIgWH9KRfAENzKzpzCetNRFdAwgX5us,414
|
|
6
|
+
xflow/framework/main.py,sha256=EIbPQ5cYKSn8BDP7OS65c9CgsOChUmq6giR3fbYzG3Y,3128
|
|
7
|
+
xflow/framework/node.py,sha256=21iQ85x7yytmnHPEOGr14zKk_IQc3ixqp5UjCTcT2uU,11975
|
|
8
|
+
xflow/framework/pipeline.py,sha256=sa82beYkEg8GdbptVa26hs6ZkqoPFdsl7a4LvOZdp7U,5404
|
|
9
|
+
xflow/framework/ssh.py,sha256=ECcK5JqAlKNGX68wKn4BD6K4z0XkCC6-5Kg8s1acHzU,11873
|
|
10
|
+
xflow/framework/utils.py,sha256=oudWRFgArvTdrSC8VHayLeI5x-k5B5TZz_MmpRXCQUc,1214
|
|
11
|
+
xflow/framework/version.py,sha256=e17lod75nE1Pm7KotA4DXcuSLFxpJ4LW5AqtTQw5Ock,83
|
|
12
|
+
xflow/framework/statics/initdir/.gitignore,sha256=drJ9PRWUOnX_mD-HEXGb__cULv6W982sW0AXcaOzJN4,4744
|
|
13
|
+
xflow/framework/statics/initdir/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
xflow/framework/statics/initdir/env.yml,sha256=sXVI3zq2AS_746MR3NGTQpVtmAUcKo7w5f4YH2et8Qo,1636
|
|
15
|
+
xflow/framework/statics/initdir/requirements.txt,sha256=lj15yzHdRYb7baWFkomr0upOJymrWeEc03jc9_osnCs,42
|
|
16
|
+
xflow/framework/statics/initdir/pipelines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
xflow/framework/statics/initdir/pipelines/example.py,sha256=kJ1RIqaEC1od9Piz3F9PO_0pooNSkZPLAB1ZrcYIxis,1883
|
|
18
|
+
xflow/framework/statics/initdir/pipelines/template.py,sha256=595PStCieqTZWj0sShU0PsvCN6aijqaSukU5TjBw0b4,721
|
|
19
|
+
xflow/framework/statics/initdir/scripts/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
xflow/framework/statics/initdir/workdir/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
xflow_framework-0.1.0.dist-info/licenses/LICENSE,sha256=xjp2TAWd0AUuZsDINij5H-63Fwlj_gY5yEv0SQvuxGs,1299
|
|
22
|
+
xflow_framework-0.1.0.dist-info/METADATA,sha256=dmH4rvzKHYm8JSsP3ffbZxYLvzl-UbxMpI4s-aOwinI,1600
|
|
23
|
+
xflow_framework-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
24
|
+
xflow_framework-0.1.0.dist-info/entry_points.txt,sha256=RAKUT9t3X0eLi9bSZRAiiksLiJrtk7jnIWgqGnua06Y,52
|
|
25
|
+
xflow_framework-0.1.0.dist-info/top_level.txt,sha256=KpSEzlVEQPRF8tqL3Szng-Fmb9CnOqIcGfPoiHRjZ8c,6
|
|
26
|
+
xflow_framework-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, zhaowcheng
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
16
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
17
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
19
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
20
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
21
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
23
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
24
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xflow
|