hohu 0.1.3__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.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: 🐛 Bug Report (English)
3
+ about: Create a report to help us improve
4
+ title: "[BUG] <short description>"
5
+ labels: bug
6
+ ---
7
+
8
+ **Describe the bug**
9
+ A clear and concise description of what the bug is.
10
+
11
+ **To Reproduce**
12
+ Steps to reproduce the behavior:
13
+ 1. Go to '...'
14
+ 2. Call endpoint '...'
15
+ 3. See error '...'
16
+
17
+ **Expected behavior**
18
+ A clear and concise description of what you expected to happen.
19
+
20
+ **Environment**
21
+ - OS: [e.g. macOS]
22
+ - Python version: [e.g. 3.11]
23
+ - FastAPI version: [e.g. 0.110.0]
24
+ - uv version: [e.g. 0.1.10]
25
+
26
+ **Additional context/Screenshots**
27
+ Add any other context about the problem or error logs here.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: 🐛 Bug 报告 (Chinese)
3
+ about: 报告程序中的错误,帮助我们改进
4
+ title: "[BUG] <简短描述错误>"
5
+ labels: bug
6
+ ---
7
+
8
+ **错误描述**
9
+ 请清晰、简要地描述该 Bug 是什么。
10
+
11
+ **复现步骤**
12
+ 1. 进入 '...'
13
+ 2. 调用接口 '...'
14
+ 3. 看到错误 '...'
15
+
16
+ **预期行为**
17
+ 你希望发生什么?
18
+
19
+ **运行环境**
20
+ - OS: [例如: Windows 11, macOS]
21
+ - Python 版本: [例如: 3.11]
22
+ - FastAPI 版本: [例如: 0.110.0]
23
+ - uv 版本: [例如: 0.1.10]
24
+
25
+ **错误日志/截图**
26
+ 如果有错误堆栈信息或截图,请在此处贴出。
27
+
28
+ **补充信息**
29
+ 关于此问题的其他任何上下文信息。
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false # 禁止创建空白 Issue,强制使用模板
2
+ contact_links:
3
+ - name: 📖 Documentation
4
+ url: https://your-docs-link.com
5
+ about: 请先查阅文档
6
+ - name: 💬 Discussions
7
+ url: https://github.com/your-username/your-repo/discussions
8
+ about: 如果只是咨询问题,请前往讨论区
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: 🚀 Feature Request (English)
3
+ about: Suggest an idea for this project
4
+ title: "[FEATURE] <feature name>"
5
+ labels: enhancement
6
+ ---
7
+
8
+ **Is your feature request related to a problem?**
9
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10
+
11
+ **Describe the solution you'd like**
12
+ A clear and concise description of what you want to happen.
13
+
14
+ **Describe alternatives you've considered**
15
+ A clear and concise description of any alternative solutions or features you've considered.
16
+
17
+ **Additional context**
18
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: 🚀 功能建议 (Chinese)
3
+ about: 为本项目提出新想法或改进建议
4
+ title: "[FEATURE] <功能名称>"
5
+ labels: enhancement
6
+ ---
7
+
8
+ **你的需求是否与某个问题有关?**
9
+ 请清晰描述,例如“当我在做...时,我感到很不方便”。
10
+
11
+ **描述你想要的解决方案**
12
+ 描述你希望实现的功能。
13
+
14
+ **描述你考虑过的替代方案**
15
+ 描述你考虑过的任何替代方案或绕过方法。
16
+
17
+ **其他背景**
18
+ 在此处添加关于功能请求的任何其他背景、参考资料或截图。
@@ -0,0 +1,17 @@
1
+ ## 📝 Description / 描述
2
+ Fixes # (issue number)
3
+
4
+ ## 🛠️ Type of Change / 修改类型
5
+ - [ ] 🐛 Bug fix (non-breaking change which fixes an issue) / Bug 修复
6
+ - [ ] ✨ New feature (non-breaking change which adds functionality) / 新功能
7
+ - [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) / 重大变更(破坏性修改)
8
+ - [ ] 📝 Documentation update / 文档更新
9
+ - [ ] ⚡ Performance improvement / 性能优化
10
+
11
+ ## ✅ Checklist / 检查清单
12
+ - [ ] I have performed a self-review of my own code / 我已完成代码自检
13
+ - [ ] I have run `uv run ruff format .` / 我已运行 Ruff 格式化
14
+ - [ ] I have run `uv run ruff check --fix .` / 我已运行 Ruff 修复 Lint
15
+ - [ ] My changes generate no new warnings / 我的修改没有产生新的警告
16
+ - [ ] I have added tests that prove my fix is effective or that my feature works / 我已添加相关测试
17
+ - [ ] New and existing unit tests pass locally with my changes / 本地所有测试均已通过
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ ruff:
11
+ name: Ruff
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v5
18
+ with:
19
+ version: "0.9.18"
20
+ enable-cache: true
21
+
22
+ - name: Set up Python
23
+ run: uv python install
24
+
25
+ - name: Install dependencies
26
+ run: uv sync --all-extras --dev
27
+
28
+ - name: Lint with Ruff
29
+ run: uv run ruff check . --output-format=github
30
+
31
+ - name: Check Formatting
32
+ run: uv run ruff format --check .
@@ -0,0 +1,46 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published] # 仅在您手动点击“Publish Release”按钮后触发
6
+
7
+ jobs:
8
+ deploy:
9
+ name: Build and Publish to PyPI
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write # 允许修改 Release 内容并上传附件
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0 # 获取完整历史以生成详细日志
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+ with:
22
+ version: "0.9.18"
23
+ enable-cache: true
24
+
25
+ - name: Set up Python
26
+ # uv 会根据 pyproject.toml 自动安装正确的 Python 版本
27
+ run: uv python install
28
+
29
+ - name: Build project
30
+ # uv 会自动生成 .tar.gz (sdist) 和 .whl (wheel)
31
+ run: uv build
32
+
33
+ # - name: Publish to PyPI
34
+ # env:
35
+ # # 必须在 GitHub Repo Settings -> Secrets 中配置此 Token
36
+ # UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
37
+ # run: |
38
+ # uv publish
39
+
40
+ - name: Upload artifacts to GitHub Release
41
+ # 将构建好的包也作为附件挂载到 GitHub Release 页面上
42
+ uses: softprops/action-gh-release@v2
43
+ with:
44
+ files: dist/*
45
+ env:
46
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
hohu-0.1.3/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ __pycache__
2
+ app.egg-info
3
+ *.pyc
4
+ .mypy_cache
5
+ .coverage
6
+ htmlcov
7
+ .cache
8
+ .venv
9
+ .conda
10
+ alembic/versions/*
11
+ .env
12
+ .env.prod
13
+ alembic.ini
14
+ .DS_Store
15
+ myapp
16
+ DEV_README.md
17
+
18
+ __pycache__/
19
+ *.py[oc]
20
+ build/
21
+ dist/
22
+ wheels/
23
+ *.egg-info
24
+
25
+ .python-version
26
+ .pytest_cache
27
+ .ruff_cache
28
+
@@ -0,0 +1,20 @@
1
+ {
2
+ // 使用 IntelliSense 了解相关属性。
3
+ // 悬停以查看现有属性的描述。
4
+ // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+
8
+ {
9
+ "name": "Debug Pancake (app/main.py)",
10
+ "type": "debugpy",
11
+ "request": "launch",
12
+ "module": "uvicorn",
13
+ "args": [
14
+ "app.main:app",
15
+ "--reload"
16
+ ],
17
+ "jinja": true
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "[python]": {
3
+ "editor.formatOnSave": true,
4
+ "editor.defaultFormatter": "charliermarsh.ruff",
5
+ "editor.codeActionsOnSave": {
6
+ "source.fixAll.ruff": "explicit",
7
+ "source.organizeImports.ruff": "explicit"
8
+ }
9
+ },
10
+ "ruff.nativeServer": true,
11
+ "python.testing.pytestArgs": [
12
+ "tests"
13
+ ],
14
+ "python.testing.unittestEnabled": false,
15
+ "python.testing.pytestEnabled": true
16
+ }
hohu-0.1.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HoHu
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.
hohu-0.1.3/PKG-INFO ADDED
@@ -0,0 +1,269 @@
1
+ Metadata-Version: 2.4
2
+ Name: hohu
3
+ Version: 0.1.3
4
+ Summary: A full-stack project management CLI tool for Hohu Admin ecosystem.
5
+ Project-URL: Homepage, https://github.com/aihohu/hohu-cli
6
+ Project-URL: Issues, https://github.com/aihohu/hohu-cli/issues
7
+ Author-email: hohu <hohu@hohu.org>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 HoHu
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Keywords: admin-system,ai,api,cli,fastapi,hohu,mcp,openapi,tools
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Environment :: Console
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Topic :: Software Development :: Code Generators
38
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
39
+ Classifier: Topic :: Utilities
40
+ Requires-Python: >=3.10
41
+ Requires-Dist: gitpython>=3.1.46
42
+ Requires-Dist: questionary>=2.1.1
43
+ Requires-Dist: rich>=14.2.0
44
+ Requires-Dist: ruff>=0.14.10
45
+ Requires-Dist: typer>=0.21.0
46
+ Description-Content-Type: text/markdown
47
+
48
+ # 📦 HoHu CLI
49
+
50
+ **HoHu CLI** 是一款为 `hohu-admin` 生态量身打造的现代化命令行工具。它集成了项目脚手架生成、自动化环境初始化和多语言切换功能,旨在提升全栈开发者的生产力。
51
+
52
+ ---
53
+
54
+ ## ✨ 特性
55
+
56
+ * 🚀 **极速启动**:基于 `uv` 开发,响应速度极快。
57
+ * 🛠️ **智能初始化**:后端自动执行 `uv sync`,前端及 APP 自动执行 `pnpm install`。
58
+ * 📂 **上下文感知**:通过项目级 `.hohu` 配置,在项目内任何路径执行 `init` 均可识别。
59
+ * 🌍 **多语言支持**:完美支持中英文切换,自动跟随系统语言。
60
+ * 🎨 **精美交互**:基于 `Rich` 和 `Questionary` 打造,提供极致的视觉与交互体验。
61
+
62
+ ---
63
+
64
+ ## 🏗️ 项目架构流
65
+
66
+ ## 📥 安装
67
+
68
+ 使用 `uv` (推荐) 或 `pip` 进行全局安装:
69
+
70
+ ```bash
71
+ # 使用 uv
72
+ uv tool install hohu
73
+
74
+ # 或使用 pip
75
+ pip install hohu
76
+
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 🚀 快速开始
82
+
83
+ ### 1. 创建新项目
84
+
85
+ 你可以直接运行 `create`。如果不提供名称,将默认创建名为 `hohu-admin` 的文件夹。
86
+
87
+ ```bash
88
+ hohu admin create my-project
89
+
90
+ ```
91
+
92
+ 系统会提示你选择需要安装的组件(后端、前端、APP)。
93
+
94
+ ### 2. 初始化环境
95
+
96
+ 进入项目目录后,直接运行 `init`。工具会自动识别项目配置并安装所有依赖。
97
+
98
+ ```bash
99
+ cd my-project
100
+ hohu admin init
101
+
102
+ ```
103
+
104
+ ### 3. 切换语言
105
+
106
+ 随时随地切换你偏好的交互语言:
107
+
108
+ ```bash
109
+ hohu lang
110
+
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 🚀 hohu admin dev 指令指南
116
+
117
+ `hohu admin dev` 是 Hohu CLI 的核心开发指令。它能一键启动全栈开发环境,并将多个服务的日志流合并输出,提供极致的联调体验。
118
+
119
+ ### 📖 基本语法
120
+
121
+ ```bash
122
+ hohu admin dev [OPTIONS]
123
+ ```
124
+
125
+ ---
126
+
127
+ ### 🛠️ 核心特性
128
+
129
+ #### 1. 彩色分流日志 (Multi-stream Logging)
130
+
131
+ 无需开启多个终端窗口。`hohu admin dev` 会为每个组件分配专属颜色,并实时合并日志:
132
+
133
+ * **[Backend]** (绿色): FastAPI 后端日志。
134
+ * **[Frontend]** (青色): Vite/React/Vue 前端日志。
135
+ * **[App]** (黄色): Uni-app/H5 移动端日志。
136
+
137
+ #### 2. 智能组件过滤 (Only / Skip)
138
+
139
+ 支持通过 `--only (-o)` 或 `--skip (-s)` 精确控制启动项,且支持**忽略大小写**与**语义简写**。
140
+
141
+ | 简写 | 对应组件 |
142
+ | --- | --- |
143
+ | `be`, `backend` | Backend |
144
+ | `fe`, `web`, `frontend` | Frontend |
145
+ | `app` | App |
146
+
147
+ #### 3. 多端运行目标 (App Target)
148
+
149
+ 针对移动端项目,支持一键切换预览环境。
150
+
151
+ ---
152
+
153
+ ### 💡 使用示例
154
+
155
+ #### ✅ 全栈启动 (默认)
156
+
157
+ 启动项目内定义的所有组件(App 默认为 H5 模式):
158
+
159
+ ```bash
160
+ hohu admin dev
161
+ ```
162
+
163
+ #### ✅ 仅启动后端 (简写模式)
164
+
165
+ 当你只想调试接口时:
166
+
167
+ ```bash
168
+ hohu admin dev -o be
169
+ ```
170
+
171
+ #### ✅ 启动前后端,跳过 APP
172
+
173
+ ```bash
174
+ hohu admin dev -o be -o fe
175
+ # 或者使用排除法
176
+ hohu admin dev -s app
177
+ ```
178
+
179
+ #### ✅ 启动并在微信小程序中预览 APP
180
+
181
+ ```bash
182
+ hohu admin dev -t mp
183
+ ```
184
+
185
+ ---
186
+
187
+ ### ⚙️ 参数详解
188
+
189
+ | 长参数 | 短参数 | 默认值 | 描述 |
190
+ | --- | --- | --- | --- |
191
+ | `--app-target` | `-t` | `h5` | APP 端启动目标:`h5`, `mp` (小程序), `app` (原生) |
192
+ | `--only` | `-o` | `None` | **仅启动**指定组件。可多次使用,支持 `be`, `fe`, `app` 等简写。 |
193
+ | `--skip` | `-s` | `None` | **跳过**指定组件。可多次使用。 |
194
+
195
+ ---
196
+
197
+ ### 🛑 安全退出
198
+
199
+ 按下 **`Ctrl + C`** 时,Hohu CLI 会:
200
+
201
+ 1. 捕获中断信号。
202
+ 2. 优雅地向所有后台进程(FastAPI, Vite 等)发送 `Terminate` 信号。
203
+ 3. 确保所有端口(8000, 9527 等)被正确释放,防止进程残留。
204
+
205
+ ---
206
+
207
+ ### 📂 原理说明
208
+
209
+ `hohu admin dev` 依赖于项目根目录下的 `.hohu/project.json` 文件。
210
+
211
+ * 如果你在非项目目录执行,工具会报错。
212
+ * 工具会根据该文件中的 `components` 列表,自动匹配本地目录(如 `hohu-admin/`)并执行对应的开发指令(如 `uv run fastapi dev`)。
213
+
214
+ ## 🛠️ 命令详解
215
+
216
+ | 命令 | 描述 |
217
+ | --- | --- |
218
+ | `hohu admin create [NAME]` | 创建项目目录并克隆选定的仓库模板 |
219
+ | `hohu admin init` | 自动化安装子项目的依赖 (uv/pnpm) |
220
+ | `hohu admin dev` | 运行项目 |
221
+ | `hohu lang`,`hohu system lang`| 切换 CLI 显示语言 (zh/en/auto) |
222
+ | `hohu info`,`hohu system info`| 查看 CLI 当前详细配置信息 |
223
+ | `hohu --version`,`-v` | 显示当前版本号 |
224
+ | `hohu --help` | 查看帮助信息 |
225
+
226
+ ---
227
+
228
+ ## 📂 推荐目录结构
229
+
230
+ 执行 `hohu admin create` 后的项目结构:
231
+
232
+ ```text
233
+ my-project/
234
+ ├── .hohu/ # HoHu 项目追踪配置
235
+ ├── hohu-admin/ # 后端项目 (FastAPI/uv)
236
+ ├── hohu-admin-web/ # 前端项目 (Vue3/pnpm)
237
+ └── hohu-admin-app/ # APP 项目 (Uni-app/pnpm)
238
+
239
+ ```
240
+
241
+ ---
242
+
243
+ ## 🤝 贡献指南
244
+
245
+ 我们非常欢迎 Issue 和 Pull Request!
246
+
247
+ 1. Fork 本仓库。
248
+ 2. 创建你的特性分支 (`git checkout -b feature/AmazingFeature`)。
249
+ 3. 提交你的更改 (`git commit -m 'Add some AmazingFeature'`)。
250
+ 4. 推送到分支 (`git push origin feature/AmazingFeature`)。
251
+ 5. 开启一个 Pull Request。
252
+
253
+ ---
254
+
255
+ ## 📄 开源协议
256
+
257
+ 本项目采用 [MIT](https://www.google.com/search?q=LICENSE) 协议。
258
+
259
+ ---
260
+
261
+ ### 💡 开发者备注
262
+
263
+ 如果你在发布到 PyPI 时遇到资源文件(JSON)丢失的问题,请确保你的 `pyproject.toml` 包含以下配置:
264
+
265
+ ```toml
266
+ [tool.hatch.build]
267
+ artifacts = ["hohu/locales/*.json"]
268
+
269
+ ```