ASF (AI Service Framework) 开发脚手架 —— 一键创建/校验 SU 模块(开箱即用,无需本地构建)
Project description
ASF Scaffold
ASF (AI Service Framework) 开发脚手架 —— 一键创建、列表、校验 SU (Service Unit) 模块。
开箱即用,无需克隆仓库或本地构建,pip 安装即可使用,模板文件已打包在 wheel 中。
安装
pip install asf-scaffold
依赖
- Python >= 3.8
- click >= 8.0
- jinja2 >= 3.0
命令一览
| 命令 | 说明 | 示例 |
|---|---|---|
asf create <category> <name> |
创建新 SU 模块 | asf create ai my_service |
asf list [category] |
列出所有 SU(扫描文件系统) | asf list / asf list ai |
asf validate <category> <name> |
校验 SU 结构 | asf validate ai sample |
使用流程
1. 创建新 SU 模块
# 创建
asf create ai my_service
# 强制覆盖已存在的模块
asf create ai my_service --force
CLI 不会修改
modules.conf,需手动注册。
创建后自动生成以下文件结构:
server/app/ai/my_service/
├── __init__.py # APIRouter 聚合
├── api.py # API 端点
├── README.md # 模块文档
├── requirements.txt # Python 依赖
├── Dockerfile # 容器构建
├── docker-compose.yml # 容器编排
├── logger.yaml # 日志配置
├── errors/
│ ├── __init__.py
│ └── error_codes.py # 错误码定义
└── nginx/
└── default.conf # Nginx 反向代理
2. 查看已有模块
# 列出所有(扫描 server/app/ 文件系统)
asf list
# 按分类过滤
asf list ai
# 详细信息(含关键文件校验)
asf list --detail
3. 校验模块结构
asf validate ai my_service
# 自动补全缺失文件
asf validate ai my_service --repair
模板变量
模板使用 Jinja2 语法渲染,可用变量:
| 变量 | 示例值 (ai/my_service) |
|---|---|
{{category}} |
ai |
{{name}} |
my_service |
{{class_name}} |
AiMyService |
{{error_prefix}} |
AI_MY_SERVICE |
{{category_title}} |
Ai |
{{name_title}} |
MyService |
{{log_path}} |
logs/ai/my_service/my_service.log |
{{image_tag}} |
registry.inspures.com/ai_su/my_service:latest |
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asf_scaffold-0.1.1.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asf_scaffold-0.1.1.tar.gz.
File metadata
- Download URL: asf_scaffold-0.1.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1115b132b7ff310a85bd1869f3e165ffde395bf95d14903c1d3c030c8d50b9e
|
|
| MD5 |
b9157b697c915250e2f0d4f2377571bd
|
|
| BLAKE2b-256 |
034e15cb4c184fe1787079959498c1c05477616fbdc1215e72fcbc48efbb03d6
|
File details
Details for the file asf_scaffold-0.1.1-py3-none-any.whl.
File metadata
- Download URL: asf_scaffold-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
405e8a162cbdad61b0c951e46e5b3b44a7c57ab083bfd6c2ef8d20c8427ae2a2
|
|
| MD5 |
319b89791efdd3eca307d136cbec0d14
|
|
| BLAKE2b-256 |
52dedf8cb43643d7bde2152e4af550e30c43a418f48d2811f8a01ea47f3ee07f
|