Skip to main content

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)。

许可证与作者

Metadata

Release files for tomskit-cli 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for tomskit-cli 0.8.0
File Interpreter ABI Platform Actions
tomskit_cli-0.8.0-py3-none-any.whl Python 3 none any Details for tomskit_cli-0.8.0-py3-none-any.whl

Release files / tomskit_cli-0.8.0-py3-none-any.whl

Download URL tomskit_cli-0.8.0-py3-none-any.whl
Size 71.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8ced6db60cc1280f9b5ba01a88dea12690f2ccad0bf8d979ecb0ec1dd382c57
BLAKE2b-256 checksum
How to use checksums
bb3b10b9b2b497cac67b691fa61c3c8bcb43753b20a147c537e3e6167fd7f3cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Security for tomskit-cli 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page