tomskit CLI: Create projects based on tomskit development framework, focusing on business logic
Project description
tomskit-cli
tomskit CLI:基于 tomskit 开发框架的项目脚手架工具,一键生成项目结构与常用组件,让你专注业务逻辑。
功能特性
- 创建新项目:支持 FastAPI、Celery 或两者兼备的完整项目模板
- 添加模块:在已有项目中快速生成完整模块(Model + Service + Controller + Schema)
- 添加组件:按需添加 Celery 任务、FastAPI 扩展、独立 Service
- 数据库迁移:为项目初始化 Alembic 迁移目录与配置
- Claude Code 支持:生成 CLAUDE.md 等 AI 辅助开发配置
安装
需要 Python 3.12+,推荐使用 uv 或 pip:
# 使用 uv(推荐)
uv tool install tomskit-cli
# 或使用 pip
pip install tomskit-cli
安装后可直接使用 tomskit 命令。
快速开始
创建新项目
# 创建完整项目(FastAPI + Celery,默认)
tomskit init my-app
# 指定项目描述与类型
tomskit init my-app -d "我的后端服务" -t full
# 仅 FastAPI
tomskit init my-api -t fastapi
# 仅 Celery
tomskit init my-worker -t celery
# 指定输出目录
tomskit init my-app -o /path/to/output
项目类型(-t / --type):
| 类型 | 说明 |
|---|---|
full |
FastAPI + Celery(默认) |
fastapi |
仅 FastAPI Web 应用 |
celery |
仅 Celery 异步任务 |
创建完成后,按终端提示执行:
cd my-app
uv sync
cp .env.example .env
# 编辑 .env 配置数据库和 Redis
在已有项目中添加内容
需在项目根目录(含 main.py 或 app/)下执行:
# 创建完整模块(Model + Service + Controller + Schema)
tomskit add module user
# 创建 Celery 异步任务
tomskit add task send_email
# 创建 FastAPI 扩展
tomskit add extension cache
# 创建独立 Service
tomskit add service payment
初始化数据库迁移
# 在当前目录对应的项目中初始化
tomskit migrations
# 指定项目目录
tomskit migrations -d /path/to/project
初始化 Claude Code 支持
tomskit claude init
# 可选:-d /path/to/project
会在项目根目录生成 CLAUDE.md 等文件,便于 AI 辅助开发。
命令一览
| 命令 | 说明 |
|---|---|
tomskit init <name> |
创建新项目 |
tomskit add module <name> |
添加完整模块 |
tomskit add task <name> |
添加 Celery 任务 |
tomskit add extension <name> |
添加 FastAPI 扩展 |
tomskit add service <name> |
添加独立 Service |
tomskit migrations |
初始化数据库迁移 |
tomskit claude init |
初始化 Claude Code 支持 |
通用选项:
-y/--yes:跳过交互提示,使用默认值-d/--dir:指定项目目录(在add、migrations、claude init等子命令中)-o/--output:init时指定目标目录-t/--type:init时指定项目类型(full / fastapi / celery)-d/--description:init时指定项目描述
Shell 自动补全
安装 argcomplete 后,可启用 Tab 补全:
Bash(写入 ~/.bashrc):
eval "$(register-python-argcomplete tomskit)"
Zsh(写入 ~/.zshrc):
autoload -U bashcompinit
bashcompinit
eval "$(register-python-argcomplete tomskit)"
开发
# 克隆仓库后
cd tomskit-cli
uv sync
# 以可编辑方式运行
uv run tomskit --help
构建与发布见项目内 Makefile(如 make build、make publish)。
许可证与作者
- 作者:aioai (ai@aioai.cc)
- 版本:见 pyproject.toml
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 Distributions
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 tomskit_cli-0.8.0-py3-none-any.whl.
File metadata
- Download URL: tomskit_cli-0.8.0-py3-none-any.whl
- Upload date:
- Size: 71.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8ced6db60cc1280f9b5ba01a88dea12690f2ccad0bf8d979ecb0ec1dd382c57
|
|
| MD5 |
3819df2685afee49732f019c51091ac7
|
|
| BLAKE2b-256 |
bb3b10b9b2b497cac67b691fa61c3c8bcb43753b20a147c537e3e6167fd7f3cc
|