pymecli 0.6.6__tar.gz → 0.6.8__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.
Files changed (54) hide show
  1. pymecli-0.6.8/PKG-INFO +225 -0
  2. pymecli-0.6.8/README.md +185 -0
  3. {pymecli-0.6.6 → pymecli-0.6.8}/cli/util.py +12 -10
  4. {pymecli-0.6.6 → pymecli-0.6.8}/core/clash.py +14 -25
  5. {pymecli-0.6.6 → pymecli-0.6.8}/pyproject.toml +3 -3
  6. pymecli-0.6.6/PKG-INFO +0 -111
  7. pymecli-0.6.6/README.md +0 -71
  8. {pymecli-0.6.6 → pymecli-0.6.8}/.gitignore +0 -0
  9. {pymecli-0.6.6 → pymecli-0.6.8}/api/__init__.py +0 -0
  10. {pymecli-0.6.6 → pymecli-0.6.8}/api/v1/__init__.py +0 -0
  11. {pymecli-0.6.6 → pymecli-0.6.8}/api/v1/clash.py +0 -0
  12. {pymecli-0.6.6 → pymecli-0.6.8}/api/v1/redis.py +0 -0
  13. {pymecli-0.6.6 → pymecli-0.6.8}/cli/__init__.py +0 -0
  14. {pymecli-0.6.6 → pymecli-0.6.8}/cli/bitget.py +0 -0
  15. {pymecli-0.6.6 → pymecli-0.6.8}/cli/dnspod.py +0 -0
  16. {pymecli-0.6.6 → pymecli-0.6.8}/cli/dst.py +0 -0
  17. {pymecli-0.6.6 → pymecli-0.6.8}/cli/etcd_sync.py +0 -0
  18. {pymecli-0.6.6 → pymecli-0.6.8}/cli/example.py +0 -0
  19. {pymecli-0.6.6 → pymecli-0.6.8}/cli/fast.py +0 -0
  20. {pymecli-0.6.6 → pymecli-0.6.8}/cli/gate.py +0 -0
  21. {pymecli-0.6.6 → pymecli-0.6.8}/cli/okx.py +0 -0
  22. {pymecli-0.6.6 → pymecli-0.6.8}/cli/quark.py +0 -0
  23. {pymecli-0.6.6 → pymecli-0.6.8}/cli/redis_csv.py +0 -0
  24. {pymecli-0.6.6 → pymecli-0.6.8}/cli/tele.py +0 -0
  25. {pymecli-0.6.6 → pymecli-0.6.8}/core/__init__.py +0 -0
  26. {pymecli-0.6.6 → pymecli-0.6.8}/core/config.py +0 -0
  27. {pymecli-0.6.6 → pymecli-0.6.8}/core/redis_client.py +0 -0
  28. {pymecli-0.6.6 → pymecli-0.6.8}/crypto/__init__.py +0 -0
  29. {pymecli-0.6.6 → pymecli-0.6.8}/crypto/bitget.py +0 -0
  30. {pymecli-0.6.6 → pymecli-0.6.8}/crypto/gate.py +0 -0
  31. {pymecli-0.6.6 → pymecli-0.6.8}/crypto/okx.py +0 -0
  32. {pymecli-0.6.6 → pymecli-0.6.8}/data/__init__.py +0 -0
  33. {pymecli-0.6.6 → pymecli-0.6.8}/data/dou_dict.py +0 -0
  34. {pymecli-0.6.6 → pymecli-0.6.8}/data/dou_list.py +0 -0
  35. {pymecli-0.6.6 → pymecli-0.6.8}/data/main.py +0 -0
  36. {pymecli-0.6.6 → pymecli-0.6.8}/data/template.yaml +0 -0
  37. {pymecli-0.6.6 → pymecli-0.6.8}/models/__init__.py +0 -0
  38. {pymecli-0.6.6 → pymecli-0.6.8}/models/douzero_model.py +0 -0
  39. {pymecli-0.6.6 → pymecli-0.6.8}/models/ocr_model.py +0 -0
  40. {pymecli-0.6.6 → pymecli-0.6.8}/models/response.py +0 -0
  41. {pymecli-0.6.6 → pymecli-0.6.8}/utils/__init__.py +0 -0
  42. {pymecli-0.6.6 → pymecli-0.6.8}/utils/elapsed.py +0 -0
  43. {pymecli-0.6.6 → pymecli-0.6.8}/utils/etcd.py +0 -0
  44. {pymecli-0.6.6 → pymecli-0.6.8}/utils/helper.py +0 -0
  45. {pymecli-0.6.6 → pymecli-0.6.8}/utils/logger.py +0 -0
  46. {pymecli-0.6.6 → pymecli-0.6.8}/utils/mysql.py +0 -0
  47. {pymecli-0.6.6 → pymecli-0.6.8}/utils/notify.py +0 -0
  48. {pymecli-0.6.6 → pymecli-0.6.8}/utils/path.py +0 -0
  49. {pymecli-0.6.6 → pymecli-0.6.8}/utils/pd.py +0 -0
  50. {pymecli-0.6.6 → pymecli-0.6.8}/utils/pyredis.py +0 -0
  51. {pymecli-0.6.6 → pymecli-0.6.8}/utils/sendNotify.py +0 -0
  52. {pymecli-0.6.6 → pymecli-0.6.8}/utils/sleep.py +0 -0
  53. {pymecli-0.6.6 → pymecli-0.6.8}/utils/text.py +0 -0
  54. {pymecli-0.6.6 → pymecli-0.6.8}/utils/toml.py +0 -0
pymecli-0.6.8/PKG-INFO ADDED
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.5
2
+ Name: pymecli
3
+ Version: 0.6.8
4
+ Summary: My CLI
5
+ Project-URL: Homepage, https://pypi.org/project/pymecli
6
+ Project-URL: Repository, https://github.com/meme2046/pymecli
7
+ License: MIT
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.10
12
+ Requires-Dist: arrow>=1.4.0
13
+ Requires-Dist: babel>=2.17.0
14
+ Requires-Dist: cowsay>=6.1
15
+ Requires-Dist: dotenv>=0.9.9
16
+ Requires-Dist: etcd3>=0.12.0
17
+ Requires-Dist: fastapi>=0.127.0
18
+ Requires-Dist: ifaddr>=0.2.0
19
+ Requires-Dist: netifaces-plus>=0.12.5
20
+ Requires-Dist: numpy<2.0.0
21
+ Requires-Dist: pandas>=2.3.3
22
+ Requires-Dist: protobuf<4
23
+ Requires-Dist: pydantic-settings>=2.14.2
24
+ Requires-Dist: pymysql>=1.1.2
25
+ Requires-Dist: pytz>=2025.2
26
+ Requires-Dist: pyyaml>=6.0.3
27
+ Requires-Dist: redis[hiredis]>=7.1.0
28
+ Requires-Dist: requests[socks]>=2.32.5
29
+ Requires-Dist: selenium>=4.40.0
30
+ Requires-Dist: slpp>=1.2.3
31
+ Requires-Dist: sqlalchemy>=2.0.45
32
+ Requires-Dist: tabulate>=0.9.0
33
+ Requires-Dist: telethon>=1.44.0
34
+ Requires-Dist: toml>=0.10.2
35
+ Requires-Dist: typer>=0.20.1
36
+ Requires-Dist: uvicorn>=0.40.0
37
+ Requires-Dist: wcwidth==0.8.5
38
+ Requires-Dist: webdriver-manager>=4.0.2
39
+ Description-Content-Type: text/markdown
40
+
41
+ # pymecli
42
+
43
+ 个人 CLI 工具集,基于 [Typer](https://typer.tiangolo.com/) 构建,包含 FastAPI 服务、Redis/MySQL/Etcd 数据同步、DDNS、加密货币行情等模块。
44
+
45
+ ## 快速开始
46
+
47
+ ```shell
48
+ # pipx install pymecli # 使用pipx安装
49
+ uv tool install pymecli # 使用uv安装
50
+ uv tool list
51
+ uv run util --help # 查看所有工具命令
52
+ ```
53
+
54
+ ## 开发
55
+ ```shell
56
+ uv sync # 安装依赖
57
+ uv run util --help # 查看所有工具命令
58
+ uv build # 打包
59
+ uv publish --token <TOKEN> # 发布到 PyPI
60
+ ```
61
+
62
+ ## 模块一览
63
+
64
+ | 命令 | 文件 | 说明 |
65
+ |---|---|---|
66
+ | `util` | `cli/util.py` | 通用工具(ID 生成、时间、emoji、IPv6 等) |
67
+ | `example` | `cli/example.py` | Typer 示例 |
68
+ | `fast` | `cli/fast.py` | FastAPI 服务(clash 订阅转换、Redis API) |
69
+ | `dst` | `cli/dst.py` | 饥荒专服模组管理 |
70
+ | `etcdsync` | `cli/etcd_sync.py` | MySQL ↔ Etcd 数据同步 |
71
+ | `quark` | `cli/quark.py` | 夸克网盘自动签到 |
72
+ | `dnspod` | `cli/dnspod.py` | DNSPod DDNS 自动更新 |
73
+ | `bitget` | `cli/bitget.py` | Bitget 行情 + grid 同步 |
74
+ | `gate` | `cli/gate.py` | Gate grid 数据同步 |
75
+ | `okx` | `cli/okx.py` | OKX grid 数据同步 |
76
+ | `rd` | `cli/redis_csv.py` | Redis ↔ CSV 数据处理 |
77
+ | `tele` | `cli/tele.py` | Telegram 工具 |
78
+
79
+ ---
80
+
81
+ ## util — 通用工具
82
+
83
+ ```shell
84
+ # 生成 secure_id(默认 30 位,字母开头,剔除 i I l L o O 0 1)
85
+ uv run util sid # 默认 30 位
86
+ uv run util sid 16 # 指定长度 16
87
+
88
+ # 生成 UUID / 打印系统信息
89
+ uv run util uuid # 输出 uuid4()
90
+ uv run util os # Windows / Darwin / Linux
91
+
92
+ # 时间戳(秒 / 毫秒)
93
+ uv run util ts # 当前秒级时间戳
94
+ uv run util ms # 当前毫秒级时间戳
95
+
96
+ # Python 版本 / 时区时间 / emoji
97
+ uv run util v # 打印 Python 版本
98
+ uv run util st # 同时打印 UTC / 美东 / 上海时间
99
+ uv run util emoji # 表格形式打印常用 emoji
100
+
101
+ # Uniswap token 排序
102
+ uv run util stoken 0xC02aaA... 0xA0b869... # 返回 token0 token1(按数值排序)
103
+
104
+ # 获取本地 IPv6 稳定地址
105
+ uv run util ipv6 # 打印并写入 Redis key: local.IPv6
106
+ ```
107
+
108
+ ## example — Typer 示例
109
+
110
+ ```shell
111
+ uv run example hello Xiaoming
112
+ uv run example hello Xiaoming --from Pymecli
113
+ uv run example goodbye Xiaoming
114
+ uv run example goodbye Xiaoming -f
115
+ ```
116
+
117
+ ## fast — FastAPI 服务
118
+
119
+ ```shell
120
+ uv run fast --port 8877 # 启动本地服务
121
+ ```
122
+
123
+ ## dst — 饥荒专服模组
124
+
125
+ ```shell
126
+ # 更新 modoverrides.lua 中指定模组的版本信息
127
+ uv run dst convert-update d:/.backups/dontstarvetogether/modoverrides.lua \
128
+ -o c:/.dst/save/Cluster_1/Master/modoverrides.lua \
129
+ -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
130
+
131
+ # 列出所有 mod,生成 dedicated_server_mods_setup.lua
132
+ uv run dst mod-setup d:/.backups/dontstarvetogether/modoverrides.lua \
133
+ -m 3486375086
134
+ ```
135
+
136
+ ## etcdsync — MySQL ↔ Etcd 同步
137
+
138
+ ```shell
139
+ # MySQL → Etcd
140
+ uv run etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
141
+ uv run etcdsync mysql2etcd "" -e d:/.env/pymecli.env -t kvs # 全量
142
+
143
+ # Etcd → MySQL
144
+ uv run etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
145
+ uv run etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
146
+
147
+ # Etcd → JSON / JSON → Etcd
148
+ uv run etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
149
+ uv run etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
150
+ ```
151
+
152
+ ## quark — 夸克网盘签到
153
+
154
+ ```shell
155
+ uv run quark sign # 签到(默认发通知)
156
+ uv run quark sign --no-notify # 签到但不发通知
157
+ uv run quark sign -e /path/to/.env # 指定 dotenv 路径
158
+ uv run quark check # 检查账号配置和成长信息
159
+ ```
160
+
161
+ ## dnspod — DDNS
162
+
163
+ ### 环境变量
164
+
165
+ - `DP_ID`: DNSPod 登录 ID
166
+ - `DP_TOKEN`: DNSPod 登录 Token
167
+ - `DP_DOMAIN`: 域名(如 cursor.email)
168
+ - `DP_RECORD_ID`: IPv4 A 记录 ID
169
+ - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
170
+ - `DP_SUB_DOMAIN`: 子域名前缀(默认 "api")
171
+ - `DP_RECORD_LINE`: 记录线路(默认 "默认")
172
+
173
+ ### 示例
174
+
175
+ ```shell
176
+ uv run dnspod list # 列出域名下所有记录(先跑这个查 record_id)
177
+ uv run dnspod ddns # 更新 IPv4 A 记录
178
+ uv run dnspod ddns --force # 强制更新(即使 IP 没变化)
179
+ uv run dnspod ddns6 # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
180
+ uv run dnspod ddns6 --force
181
+ ```
182
+
183
+ ## bitget — Bitget 行情
184
+
185
+ ```shell
186
+ # 同步 MySQL grid 数据到 Redis
187
+ uv run bitget sync d:/.env/pymecli.env
188
+
189
+ # 获取现货 / 合约价格(支持代理)
190
+ uv run bitget spot BTCUSDT,ETHUSDT
191
+ uv run bitget spot BTCUSDT -p http://127.0.0.1:7897
192
+ uv run bitget mix BTCUSDT_UMCBL,SOLUSDT_UMCBL -p http://127.0.0.1:7897
193
+ ```
194
+
195
+ ## gate / okx — Grid 数据同步
196
+
197
+ ```shell
198
+ uv run gate d:/.env/pymecli.env # Gate → Redis
199
+ uv run okx d:/.env/pymecli.env # OKX → Redis
200
+ ```
201
+
202
+ ## rd — Redis ↔ CSV
203
+
204
+ ```shell
205
+ # 查询 Redis ZSet 记录数
206
+ uv run rd count my_prefix
207
+
208
+ # CSV → Redis(按 id1、id2 组合 key)
209
+ uv run rd csv2redis symbol timeframe -fp data/file.csv -kp my_prefix
210
+
211
+ # CSV → CSV(时间字符串转时间戳、删列)
212
+ uv run rd convert data/file.csv
213
+ ```
214
+
215
+ ## tele — Telegram 工具
216
+
217
+ > 需先在 `pyproject.toml` 的 `[project.scripts]` 取消注释 `tele = "cli.tele:app"`。
218
+
219
+ ```shell
220
+ uv run tele info .env # 查看 TELE_SESSION_STRING
221
+ uv run tele check .env # 验证 session 是否有效
222
+ uv run tele login .env # 登录生成新 session
223
+ uv run tele upload image.jpg # 上传图片到 Telegram
224
+ uv run tele list-channels .env # 列出已加入的频道
225
+ ```
@@ -0,0 +1,185 @@
1
+ # pymecli
2
+
3
+ 个人 CLI 工具集,基于 [Typer](https://typer.tiangolo.com/) 构建,包含 FastAPI 服务、Redis/MySQL/Etcd 数据同步、DDNS、加密货币行情等模块。
4
+
5
+ ## 快速开始
6
+
7
+ ```shell
8
+ # pipx install pymecli # 使用pipx安装
9
+ uv tool install pymecli # 使用uv安装
10
+ uv tool list
11
+ uv run util --help # 查看所有工具命令
12
+ ```
13
+
14
+ ## 开发
15
+ ```shell
16
+ uv sync # 安装依赖
17
+ uv run util --help # 查看所有工具命令
18
+ uv build # 打包
19
+ uv publish --token <TOKEN> # 发布到 PyPI
20
+ ```
21
+
22
+ ## 模块一览
23
+
24
+ | 命令 | 文件 | 说明 |
25
+ |---|---|---|
26
+ | `util` | `cli/util.py` | 通用工具(ID 生成、时间、emoji、IPv6 等) |
27
+ | `example` | `cli/example.py` | Typer 示例 |
28
+ | `fast` | `cli/fast.py` | FastAPI 服务(clash 订阅转换、Redis API) |
29
+ | `dst` | `cli/dst.py` | 饥荒专服模组管理 |
30
+ | `etcdsync` | `cli/etcd_sync.py` | MySQL ↔ Etcd 数据同步 |
31
+ | `quark` | `cli/quark.py` | 夸克网盘自动签到 |
32
+ | `dnspod` | `cli/dnspod.py` | DNSPod DDNS 自动更新 |
33
+ | `bitget` | `cli/bitget.py` | Bitget 行情 + grid 同步 |
34
+ | `gate` | `cli/gate.py` | Gate grid 数据同步 |
35
+ | `okx` | `cli/okx.py` | OKX grid 数据同步 |
36
+ | `rd` | `cli/redis_csv.py` | Redis ↔ CSV 数据处理 |
37
+ | `tele` | `cli/tele.py` | Telegram 工具 |
38
+
39
+ ---
40
+
41
+ ## util — 通用工具
42
+
43
+ ```shell
44
+ # 生成 secure_id(默认 30 位,字母开头,剔除 i I l L o O 0 1)
45
+ uv run util sid # 默认 30 位
46
+ uv run util sid 16 # 指定长度 16
47
+
48
+ # 生成 UUID / 打印系统信息
49
+ uv run util uuid # 输出 uuid4()
50
+ uv run util os # Windows / Darwin / Linux
51
+
52
+ # 时间戳(秒 / 毫秒)
53
+ uv run util ts # 当前秒级时间戳
54
+ uv run util ms # 当前毫秒级时间戳
55
+
56
+ # Python 版本 / 时区时间 / emoji
57
+ uv run util v # 打印 Python 版本
58
+ uv run util st # 同时打印 UTC / 美东 / 上海时间
59
+ uv run util emoji # 表格形式打印常用 emoji
60
+
61
+ # Uniswap token 排序
62
+ uv run util stoken 0xC02aaA... 0xA0b869... # 返回 token0 token1(按数值排序)
63
+
64
+ # 获取本地 IPv6 稳定地址
65
+ uv run util ipv6 # 打印并写入 Redis key: local.IPv6
66
+ ```
67
+
68
+ ## example — Typer 示例
69
+
70
+ ```shell
71
+ uv run example hello Xiaoming
72
+ uv run example hello Xiaoming --from Pymecli
73
+ uv run example goodbye Xiaoming
74
+ uv run example goodbye Xiaoming -f
75
+ ```
76
+
77
+ ## fast — FastAPI 服务
78
+
79
+ ```shell
80
+ uv run fast --port 8877 # 启动本地服务
81
+ ```
82
+
83
+ ## dst — 饥荒专服模组
84
+
85
+ ```shell
86
+ # 更新 modoverrides.lua 中指定模组的版本信息
87
+ uv run dst convert-update d:/.backups/dontstarvetogether/modoverrides.lua \
88
+ -o c:/.dst/save/Cluster_1/Master/modoverrides.lua \
89
+ -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
90
+
91
+ # 列出所有 mod,生成 dedicated_server_mods_setup.lua
92
+ uv run dst mod-setup d:/.backups/dontstarvetogether/modoverrides.lua \
93
+ -m 3486375086
94
+ ```
95
+
96
+ ## etcdsync — MySQL ↔ Etcd 同步
97
+
98
+ ```shell
99
+ # MySQL → Etcd
100
+ uv run etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
101
+ uv run etcdsync mysql2etcd "" -e d:/.env/pymecli.env -t kvs # 全量
102
+
103
+ # Etcd → MySQL
104
+ uv run etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
105
+ uv run etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
106
+
107
+ # Etcd → JSON / JSON → Etcd
108
+ uv run etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
109
+ uv run etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
110
+ ```
111
+
112
+ ## quark — 夸克网盘签到
113
+
114
+ ```shell
115
+ uv run quark sign # 签到(默认发通知)
116
+ uv run quark sign --no-notify # 签到但不发通知
117
+ uv run quark sign -e /path/to/.env # 指定 dotenv 路径
118
+ uv run quark check # 检查账号配置和成长信息
119
+ ```
120
+
121
+ ## dnspod — DDNS
122
+
123
+ ### 环境变量
124
+
125
+ - `DP_ID`: DNSPod 登录 ID
126
+ - `DP_TOKEN`: DNSPod 登录 Token
127
+ - `DP_DOMAIN`: 域名(如 cursor.email)
128
+ - `DP_RECORD_ID`: IPv4 A 记录 ID
129
+ - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
130
+ - `DP_SUB_DOMAIN`: 子域名前缀(默认 "api")
131
+ - `DP_RECORD_LINE`: 记录线路(默认 "默认")
132
+
133
+ ### 示例
134
+
135
+ ```shell
136
+ uv run dnspod list # 列出域名下所有记录(先跑这个查 record_id)
137
+ uv run dnspod ddns # 更新 IPv4 A 记录
138
+ uv run dnspod ddns --force # 强制更新(即使 IP 没变化)
139
+ uv run dnspod ddns6 # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
140
+ uv run dnspod ddns6 --force
141
+ ```
142
+
143
+ ## bitget — Bitget 行情
144
+
145
+ ```shell
146
+ # 同步 MySQL grid 数据到 Redis
147
+ uv run bitget sync d:/.env/pymecli.env
148
+
149
+ # 获取现货 / 合约价格(支持代理)
150
+ uv run bitget spot BTCUSDT,ETHUSDT
151
+ uv run bitget spot BTCUSDT -p http://127.0.0.1:7897
152
+ uv run bitget mix BTCUSDT_UMCBL,SOLUSDT_UMCBL -p http://127.0.0.1:7897
153
+ ```
154
+
155
+ ## gate / okx — Grid 数据同步
156
+
157
+ ```shell
158
+ uv run gate d:/.env/pymecli.env # Gate → Redis
159
+ uv run okx d:/.env/pymecli.env # OKX → Redis
160
+ ```
161
+
162
+ ## rd — Redis ↔ CSV
163
+
164
+ ```shell
165
+ # 查询 Redis ZSet 记录数
166
+ uv run rd count my_prefix
167
+
168
+ # CSV → Redis(按 id1、id2 组合 key)
169
+ uv run rd csv2redis symbol timeframe -fp data/file.csv -kp my_prefix
170
+
171
+ # CSV → CSV(时间字符串转时间戳、删列)
172
+ uv run rd convert data/file.csv
173
+ ```
174
+
175
+ ## tele — Telegram 工具
176
+
177
+ > 需先在 `pyproject.toml` 的 `[project.scripts]` 取消注释 `tele = "cli.tele:app"`。
178
+
179
+ ```shell
180
+ uv run tele info .env # 查看 TELE_SESSION_STRING
181
+ uv run tele check .env # 验证 session 是否有效
182
+ uv run tele login .env # 登录生成新 session
183
+ uv run tele upload image.jpg # 上传图片到 Telegram
184
+ uv run tele list-channels .env # 列出已加入的频道
185
+ ```
@@ -24,15 +24,17 @@ app = typer.Typer()
24
24
  def sid(
25
25
  length: int = typer.Argument(30, help="生成secure_id的长度"),
26
26
  ):
27
+ # 剔除易混淆字符: i I l L o O 0 1
27
28
  chars = (
28
29
  (string.ascii_letters + string.digits)
29
- .replace("i", "")
30
- .replace("I", "")
31
- .replace("o", "")
32
- .replace("O", "")
30
+ .replace("i", "").replace("I", "")
31
+ .replace("l", "").replace("L", "")
32
+ .replace("o", "").replace("O", "")
33
+ .replace("0", "").replace("1", "")
33
34
  )
34
- id = "".join(secrets.choice(chars) for _ in range(length))
35
- print(id)
35
+ first = secrets.choice(string.ascii_letters) # 字母开头
36
+ rest = "".join(secrets.choice(chars) for _ in range(max(0, length - 1)))
37
+ print(first + rest)
36
38
 
37
39
 
38
40
  @app.command()
@@ -75,14 +77,14 @@ def emoji():
75
77
  ).split()
76
78
 
77
79
  # tabulate 用 len() 算列宽,终端用 wcswidth() 算显示宽度,
78
- # 需要把每个 emoji 补到 len=2 且 wcswidth=2 才能对齐
79
- # - SMP emoji (len=1, wcsw=2): 加 VS(U+FE0F) 变 len=2
80
+ # 需要把每个字符补到 len=2 且 wcswidth=2 才能对齐
81
+ # - 宽字符 (len=1, wcsw=2): 加 ZWSP(U+200B 零宽空格) 补 len,不改显示
80
82
  # - 窄符号 (wcsw=1): 用 wcwidth.ljust 补空格到 wcsw=2
81
- VS = "\ufe0f"
83
+ ZWSP = "\u200b"
82
84
 
83
85
  def pad(e: str) -> str:
84
86
  if len(e) == 1 and wcswidth(e) == 2:
85
- e += VS
87
+ e += ZWSP
86
88
  return ljust(e, 2)
87
89
 
88
90
  padded = [pad(e) for e in emoji_list]
@@ -7,7 +7,9 @@ from fastapi import Depends
7
7
 
8
8
  module_dir = Path(__file__).resolve().parent.parent
9
9
 
10
- TEMPLATE_URL = "https://raw.githubusercontent.com/meme2046/data/main/clash/template.yaml"
10
+ TEMPLATE_URL = (
11
+ "https://raw.githubusercontent.com/meme2046/data/main/clash/template.yaml"
12
+ )
11
13
 
12
14
  # 白名单模式最终规则
13
15
  WHITELIST_RULES = [
@@ -52,7 +54,9 @@ class ClashYamlGenerator:
52
54
 
53
55
  # ---------- 通用 helpers ----------
54
56
 
55
- def _dedupe_proxy_names(self, existing_proxies: list, new_proxies: list, suffix: str = "_custom") -> list:
57
+ def _dedupe_proxy_names(
58
+ self, existing_proxies: list, new_proxies: list, suffix: str = "_custom"
59
+ ) -> list:
56
60
  """对 new_proxies 里与 existing_proxies 重名的节点改名加后缀。
57
61
 
58
62
  例:已有 "lighthouse",custom 也有 "lighthouse" → 改名为 "lighthouse_custom"
@@ -123,10 +127,10 @@ class ClashYamlGenerator:
123
127
  def _add_inline_rule_providers(self, template, proxies):
124
128
  """从 my_rule_base_url 拉取 inline 规则集并写入 template"""
125
129
  rule_list = [
126
- [f"{self.my_rule_base_url}/direct.yaml", "DIRECT"],
130
+ [f"{self.my_rule_base_url}/reject.yaml", "REJECT"],
127
131
  [f"{self.my_rule_base_url}/proxy.yaml", "全局选择"],
128
132
  [f"{self.my_rule_base_url}/round.yaml", "轮询"],
129
- [f"{self.my_rule_base_url}/reject.yaml", "REJECT"],
133
+ [f"{self.my_rule_base_url}/direct.yaml", "DIRECT"],
130
134
  ]
131
135
  for url, target in rule_list:
132
136
  response = requests.get(url, proxies=proxies)
@@ -268,25 +272,6 @@ class ClashYamlGenerator:
268
272
 
269
273
  def _add_base_rules(self, template, with_dst_port=False):
270
274
  """IP-CIDR / DOMAIN 基础规则(genPB / genB),genB 含饥荒端口"""
271
- template["rules"].extend(
272
- [
273
- "IP-CIDR,192.168.0.0/16,DIRECT,no-resolve",
274
- "IP-CIDR,10.0.0.0/8,DIRECT,no-resolve",
275
- "IP-CIDR,172.16.0.0/12,DIRECT,no-resolve",
276
- "IP-CIDR,127.0.0.0/8,DIRECT,no-resolve",
277
- ]
278
- )
279
- if with_dst_port:
280
- template["rules"].extend(
281
- [
282
- "DST-PORT,10999,DIRECT",
283
- "DST-PORT,10998,DIRECT",
284
- "DST-PORT,27016,DIRECT",
285
- "DST-PORT,27017,DIRECT",
286
- "DST-PORT,8766,DIRECT",
287
- "DST-PORT,8767,DIRECT",
288
- ]
289
- )
290
275
  template["rules"].extend(
291
276
  [
292
277
  "DOMAIN,clash.razord.top,DIRECT",
@@ -303,7 +288,9 @@ class ClashYamlGenerator:
303
288
  template = self._load_template(proxies)
304
289
 
305
290
  has_custom = bool(custom_proxies)
306
- template["proxy-groups"].extend(self._provider_proxy_groups(sub_list, has_custom))
291
+ template["proxy-groups"].extend(
292
+ self._provider_proxy_groups(sub_list, has_custom)
293
+ )
307
294
 
308
295
  subs, userinfo = self._fetch_subscriptions(sub_list, proxies)
309
296
  for item, ps in subs:
@@ -339,7 +326,9 @@ class ClashYamlGenerator:
339
326
  template = self._load_template(proxies)
340
327
 
341
328
  has_custom = bool(custom_proxies)
342
- template["proxy-groups"].extend(self._provider_proxy_groups(sub_list, has_custom))
329
+ template["proxy-groups"].extend(
330
+ self._provider_proxy_groups(sub_list, has_custom)
331
+ )
343
332
 
344
333
  subs, userinfo = self._fetch_subscriptions(sub_list, proxies)
345
334
  for item, ps in subs:
@@ -33,13 +33,13 @@
33
33
  "telethon>=1.44.0",
34
34
  "protobuf<4",
35
35
  "wcwidth==0.8.5",
36
- ]
36
+ ]
37
37
  description = "My CLI"
38
38
  license = { text = "MIT" }
39
39
  name = "pymecli"
40
40
  readme = "README.md"
41
41
  requires-python = ">=3.10"
42
- version = "0.6.6"
42
+ version = "0.6.8"
43
43
 
44
44
  [project.urls]
45
45
  Homepage = "https://pypi.org/project/pymecli"
@@ -59,7 +59,7 @@
59
59
  util = "cli.util:app"
60
60
  # 临时命令
61
61
  rd = "cli.redis_csv:app"
62
- # tele = "cli.tele:app"
62
+ tele = "cli.tele:app"
63
63
 
64
64
  [tool.uv]
65
65
  [[tool.uv.index]]
pymecli-0.6.6/PKG-INFO DELETED
@@ -1,111 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: pymecli
3
- Version: 0.6.6
4
- Summary: My CLI
5
- Project-URL: Homepage, https://pypi.org/project/pymecli
6
- Project-URL: Repository, https://github.com/meme2046/pymecli
7
- License: MIT
8
- Classifier: Intended Audience :: Developers
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Requires-Python: >=3.10
12
- Requires-Dist: arrow>=1.4.0
13
- Requires-Dist: babel>=2.17.0
14
- Requires-Dist: cowsay>=6.1
15
- Requires-Dist: dotenv>=0.9.9
16
- Requires-Dist: etcd3>=0.12.0
17
- Requires-Dist: fastapi>=0.127.0
18
- Requires-Dist: ifaddr>=0.2.0
19
- Requires-Dist: netifaces-plus>=0.12.5
20
- Requires-Dist: numpy<2.0.0
21
- Requires-Dist: pandas>=2.3.3
22
- Requires-Dist: protobuf<4
23
- Requires-Dist: pydantic-settings>=2.14.2
24
- Requires-Dist: pymysql>=1.1.2
25
- Requires-Dist: pytz>=2025.2
26
- Requires-Dist: pyyaml>=6.0.3
27
- Requires-Dist: redis[hiredis]>=7.1.0
28
- Requires-Dist: requests[socks]>=2.32.5
29
- Requires-Dist: selenium>=4.40.0
30
- Requires-Dist: slpp>=1.2.3
31
- Requires-Dist: sqlalchemy>=2.0.45
32
- Requires-Dist: tabulate>=0.9.0
33
- Requires-Dist: telethon>=1.44.0
34
- Requires-Dist: toml>=0.10.2
35
- Requires-Dist: typer>=0.20.1
36
- Requires-Dist: uvicorn>=0.40.0
37
- Requires-Dist: wcwidth==0.8.5
38
- Requires-Dist: webdriver-manager>=4.0.2
39
- Description-Content-Type: text/markdown
40
-
41
- # typer example
42
-
43
- ```shell
44
- uv run example hello Xiaoming
45
- uv run example hello Xiaoming --from Pymecli
46
- uv run example goodbye Xiaoming
47
- uv run example goodbye Xiaoming -f
48
- ```
49
-
50
- # fastapi server
51
-
52
- ```shell
53
- uv run fast --port 8877 # local server
54
- uv build
55
- uv publish --token < TOKEN > # publish
56
- ```
57
-
58
- # dontstarvetogether
59
-
60
- 1. 饥荒专服禁client mods使用, 更新client mods version, modoverrides.lua:
61
-
62
- ```shell
63
- uv run dst cmu d:/.backups/dontstarvetogether/modoverrides.lua -o c:/.dst/save/Cluster_1/Master/modoverrides.lua -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
64
-
65
- uv run dst cml d:/.backups/dontstarvetogether/modoverrides.lua -m 3486375086
66
- ```
67
-
68
- # etcdsync
69
-
70
- ```shell
71
- etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
72
- etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
73
- etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
74
- etcdsync mysql2etcd -e d:/.env/pymecli.env -t kvs # 全量
75
-
76
- etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
77
- etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
78
- ```
79
- # quark
80
- ```shell
81
- # 执行签到(默认会发通知)
82
- uv run quark sign
83
- # 签到但不发通知
84
- uv run quark sign --no-notify
85
- # 指定不同的 dotenv 路径
86
- uv run quark sign -e /path/to/.env
87
- # 只检查账号状态(不签到),方便调试
88
- uv run quark check
89
- ```
90
-
91
- # dnspod
92
- ## 环境变量说明
93
- - `DP_ID`: DNSPod 登录 ID
94
- - `DP_TOKEN`: DNSPod 登录 Token
95
- - `DP_DOMAIN`: 域名 (如 cursor.email)
96
- - `DP_RECORD_ID`: IPv4 A 记录 ID
97
- - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
98
- - `DP_SUB_DOMAIN`: 子域名前缀 (默认 "api")
99
- - `DP_RECORD_LINE`: 记录线路 (默认 "默认")
100
- ## 示例
101
- ```shell
102
- # 列出域名下所有记录(先跑这个查 record_id)
103
- uv run dnspod list
104
- # 更新 IPv4 A 记录
105
- uv run dnspod ddns
106
- # 强制更新(即使 IP 没变化)
107
- uv run dnspod ddns --force
108
- # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
109
- uv run dnspod ddns6
110
- uv run dnspod ddns6 --force
111
- ```
pymecli-0.6.6/README.md DELETED
@@ -1,71 +0,0 @@
1
- # typer example
2
-
3
- ```shell
4
- uv run example hello Xiaoming
5
- uv run example hello Xiaoming --from Pymecli
6
- uv run example goodbye Xiaoming
7
- uv run example goodbye Xiaoming -f
8
- ```
9
-
10
- # fastapi server
11
-
12
- ```shell
13
- uv run fast --port 8877 # local server
14
- uv build
15
- uv publish --token < TOKEN > # publish
16
- ```
17
-
18
- # dontstarvetogether
19
-
20
- 1. 饥荒专服禁client mods使用, 更新client mods version, modoverrides.lua:
21
-
22
- ```shell
23
- uv run dst cmu d:/.backups/dontstarvetogether/modoverrides.lua -o c:/.dst/save/Cluster_1/Master/modoverrides.lua -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
24
-
25
- uv run dst cml d:/.backups/dontstarvetogether/modoverrides.lua -m 3486375086
26
- ```
27
-
28
- # etcdsync
29
-
30
- ```shell
31
- etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
32
- etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
33
- etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
34
- etcdsync mysql2etcd -e d:/.env/pymecli.env -t kvs # 全量
35
-
36
- etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
37
- etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
38
- ```
39
- # quark
40
- ```shell
41
- # 执行签到(默认会发通知)
42
- uv run quark sign
43
- # 签到但不发通知
44
- uv run quark sign --no-notify
45
- # 指定不同的 dotenv 路径
46
- uv run quark sign -e /path/to/.env
47
- # 只检查账号状态(不签到),方便调试
48
- uv run quark check
49
- ```
50
-
51
- # dnspod
52
- ## 环境变量说明
53
- - `DP_ID`: DNSPod 登录 ID
54
- - `DP_TOKEN`: DNSPod 登录 Token
55
- - `DP_DOMAIN`: 域名 (如 cursor.email)
56
- - `DP_RECORD_ID`: IPv4 A 记录 ID
57
- - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
58
- - `DP_SUB_DOMAIN`: 子域名前缀 (默认 "api")
59
- - `DP_RECORD_LINE`: 记录线路 (默认 "默认")
60
- ## 示例
61
- ```shell
62
- # 列出域名下所有记录(先跑这个查 record_id)
63
- uv run dnspod list
64
- # 更新 IPv4 A 记录
65
- uv run dnspod ddns
66
- # 强制更新(即使 IP 没变化)
67
- uv run dnspod ddns --force
68
- # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
69
- uv run dnspod ddns6
70
- uv run dnspod ddns6 --force
71
- ```
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes