suanqi 0.1.0__tar.gz
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.
- suanqi-0.1.0/LICENSE +21 -0
- suanqi-0.1.0/PKG-INFO +73 -0
- suanqi-0.1.0/README.md +45 -0
- suanqi-0.1.0/pyproject.toml +59 -0
- suanqi-0.1.0/setup.cfg +4 -0
- suanqi-0.1.0/src/suanqi/__init__.py +3 -0
- suanqi-0.1.0/src/suanqi/cli.py +76 -0
- suanqi-0.1.0/src/suanqi/gateway/__init__.py +15 -0
- suanqi-0.1.0/src/suanqi/gateway/tencent_gateway.py +688 -0
- suanqi-0.1.0/src/suanqi/providers/__init__.py +5 -0
- suanqi-0.1.0/src/suanqi/providers/tencentcloud.py +1730 -0
- suanqi-0.1.0/src/suanqi.egg-info/PKG-INFO +73 -0
- suanqi-0.1.0/src/suanqi.egg-info/SOURCES.txt +15 -0
- suanqi-0.1.0/src/suanqi.egg-info/dependency_links.txt +1 -0
- suanqi-0.1.0/src/suanqi.egg-info/entry_points.txt +2 -0
- suanqi-0.1.0/src/suanqi.egg-info/requires.txt +2 -0
- suanqi-0.1.0/src/suanqi.egg-info/top_level.txt +1 -0
suanqi-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Keyu Zhu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
suanqi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: suanqi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Run compute tasks on temporary cloud servers from a local command.
|
|
5
|
+
Author: Keyu Zhu
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/zhukeyu8303/SuanQi
|
|
8
|
+
Project-URL: Repository, https://github.com/zhukeyu8303/SuanQi
|
|
9
|
+
Project-URL: Issues, https://github.com/zhukeyu8303/SuanQi/issues
|
|
10
|
+
Keywords: cloud-computing,tencent-cloud,cvm,cli,remote-execution,spot-instance
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
21
|
+
Classifier: Topic :: System :: Systems Administration
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: tencentcloud-sdk-python>=3.0.0
|
|
26
|
+
Requires-Dist: datetime
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# SuanQi 腾讯云网关
|
|
30
|
+
|
|
31
|
+
## 项目结构
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
suanqi_gateway_complete/
|
|
35
|
+
├── gateway/
|
|
36
|
+
│ ├── __init__.py
|
|
37
|
+
│ └── tencent_gateway.py
|
|
38
|
+
├── main.py
|
|
39
|
+
└── requirements.txt
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 安装
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install -r requirements.txt
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## PowerShell 配置密钥
|
|
49
|
+
|
|
50
|
+
```powershell
|
|
51
|
+
$env:TENCENTCLOUD_SECRET_ID="你的SecretId"
|
|
52
|
+
$env:TENCENTCLOUD_SECRET_KEY="你的SecretKey"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 运行
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python main.py
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`main.py` 默认只查询和询价,不创建收费实例。
|
|
62
|
+
|
|
63
|
+
正式测试创建时,将:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
CREATE_INSTANCE = False
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
改为:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
CREATE_INSTANCE = True
|
|
73
|
+
```
|
suanqi-0.1.0/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# SuanQi 腾讯云网关
|
|
2
|
+
|
|
3
|
+
## 项目结构
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
suanqi_gateway_complete/
|
|
7
|
+
├── gateway/
|
|
8
|
+
│ ├── __init__.py
|
|
9
|
+
│ └── tencent_gateway.py
|
|
10
|
+
├── main.py
|
|
11
|
+
└── requirements.txt
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install -r requirements.txt
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## PowerShell 配置密钥
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
$env:TENCENTCLOUD_SECRET_ID="你的SecretId"
|
|
24
|
+
$env:TENCENTCLOUD_SECRET_KEY="你的SecretKey"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 运行
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python main.py
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`main.py` 默认只查询和询价,不创建收费实例。
|
|
34
|
+
|
|
35
|
+
正式测试创建时,将:
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
CREATE_INSTANCE = False
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
改为:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
CREATE_INSTANCE = True
|
|
45
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "suanqi"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
description = "Run compute tasks on temporary cloud servers from a local command."
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
|
|
15
|
+
authors = [
|
|
16
|
+
{ name = "Keyu Zhu" }
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
keywords = [
|
|
20
|
+
"cloud-computing",
|
|
21
|
+
"tencent-cloud",
|
|
22
|
+
"cvm",
|
|
23
|
+
"cli",
|
|
24
|
+
"remote-execution",
|
|
25
|
+
"spot-instance"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
30
|
+
"Environment :: Console",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
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 :: System :: Distributed Computing",
|
|
39
|
+
"Topic :: System :: Systems Administration"
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
dependencies = [
|
|
43
|
+
"tencentcloud-sdk-python>=3.0.0",
|
|
44
|
+
"datetime"
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
Homepage = "https://github.com/zhukeyu8303/SuanQi"
|
|
50
|
+
Repository = "https://github.com/zhukeyu8303/SuanQi"
|
|
51
|
+
Issues = "https://github.com/zhukeyu8303/SuanQi/issues"
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
suanqi = "suanqi.cli:main"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.packages.find]
|
|
59
|
+
where = ["src"]
|
suanqi-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
|
|
5
|
+
from .providers import tencentcloud_run
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
9
|
+
parser = argparse.ArgumentParser(
|
|
10
|
+
prog="suanqi",
|
|
11
|
+
description=(
|
|
12
|
+
"选择云服务器、创建实例并执行计算任务。"
|
|
13
|
+
),
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
parser.add_argument(
|
|
17
|
+
"command",
|
|
18
|
+
choices=[
|
|
19
|
+
"run",
|
|
20
|
+
],
|
|
21
|
+
help="要执行的操作。",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
"--provider",
|
|
26
|
+
default="tencentcloud",
|
|
27
|
+
choices=[
|
|
28
|
+
"tencentcloud",
|
|
29
|
+
],
|
|
30
|
+
help="云服务提供商。",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return parser
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def main() -> int:
|
|
37
|
+
parser = build_parser()
|
|
38
|
+
arguments = parser.parse_args()
|
|
39
|
+
|
|
40
|
+
if arguments.command == "run":
|
|
41
|
+
if arguments.provider == "tencentcloud":
|
|
42
|
+
result = tencentcloud_run()
|
|
43
|
+
|
|
44
|
+
if not result:
|
|
45
|
+
return 1
|
|
46
|
+
|
|
47
|
+
if not result.get("success"):
|
|
48
|
+
print(
|
|
49
|
+
"实例创建失败:"
|
|
50
|
+
f"{result.get('error_message')}"
|
|
51
|
+
)
|
|
52
|
+
return 1
|
|
53
|
+
|
|
54
|
+
print("\n实例创建成功:")
|
|
55
|
+
print(
|
|
56
|
+
f"实例 ID:"
|
|
57
|
+
f"{result.get('instance_id')}"
|
|
58
|
+
)
|
|
59
|
+
print(
|
|
60
|
+
f"公网 IP:"
|
|
61
|
+
f"{result.get('public_ip')}"
|
|
62
|
+
)
|
|
63
|
+
print(
|
|
64
|
+
f"配置:"
|
|
65
|
+
f"{result.get('cpu')} 核 / "
|
|
66
|
+
f"{result.get('memory_gb')} GB"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# 不要打印 instance_password
|
|
70
|
+
return 0
|
|
71
|
+
|
|
72
|
+
return 1
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
from .tencent_gateway import (
|
|
4
|
+
GatewayResult,
|
|
5
|
+
InstanceConfig,
|
|
6
|
+
TencentCloudGateway,
|
|
7
|
+
TencentGatewayError,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"GatewayResult",
|
|
12
|
+
"InstanceConfig",
|
|
13
|
+
"TencentCloudGateway",
|
|
14
|
+
"TencentGatewayError",
|
|
15
|
+
]
|