Multi-language automated build tool with domestic mirror acceleration support
Project description
🚀 AutoBuild
多语言自动化构建工具
支持前端 pnpm、后端 Go、Python,一键加速国内镜像
特性 • 快速开始 • IDE 集成 • 安装 • 详细文档 • 许可证
✨ 特性
🎯 多语言支持
|
⚡ 镜像加速
|
🔧 开发者友好
|
🚀 快速开始
安装
pip install multi-lang-build
# 配置国内镜像(可选)
multi-lang-build mirror set pip # pip 使用清华镜像
multi-lang-build mirror set go # Go 使用 goproxy.cn
multi-lang-build mirror set npm # npm/pnpm 使用 npmmirror
1. 构建 Go 项目(支持多入口)
from multi_lang_build import GoCompiler
from pathlib import Path
compiler = GoCompiler()
# 指定入口文件编译(同一目录多 main 文件)
compiler.build_binary(
source_dir=Path("./myproject"),
output_path=Path("./bin/server"),
target="server.go", # 🎯 指定入口文件
mirror_enabled=True
)
# 指定子目录编译(cmd 结构)
compiler.build_binary(
source_dir=Path("./myproject"),
output_path=Path("./bin/client"),
target="./cmd/client", # 📁 指定包路径
mirror_enabled=True
)
2. 构建 Python 项目
from multi_lang_build import PythonCompiler
compiler = PythonCompiler()
# 自动检测并安装依赖(支持 Poetry/Setuptools/PDM)
compiler.install_dependencies(
source_dir=Path("./myproject"),
mirror_enabled=True,
dev=True
)
# 构建项目
compiler.build(
source_dir=Path("./myproject"),
output_dir=Path("./dist"),
mirror_enabled=True
)
3. 构建前端项目
from multi_lang_build import PnpmCompiler
compiler = PnpmCompiler()
# 自动检测项目根目录(支持子目录调用)
compiler.build(
source_dir=Path("./packages/ui/src"), # 即使在子目录也能正确构建
output_dir=Path("./dist"),
mirror_enabled=True
)
🎯 IDE 集成
将 multi-lang-build 注册为 IDE 技能,获得更智能的构建体验。
支持的 IDE
| IDE | 命令 | 说明 |
|---|---|---|
| 🤖 Claude Code | multi-lang-build register |
默认,AI 助手原生支持 |
| 💠 OpenCode | multi-lang-build register opencode |
智能代码助手集成 |
| 🔷 Trae | multi-lang-build register trae |
字节跳动 AI IDE |
| 🎯 CodeBuddy | multi-lang-build register codebuddy |
代码伙伴插件 |
注册 Claude Code(默认)
# 默认注册到项目级(.claude/multi-lang-build.md)
multi-lang-build register
# 或使用完整命令
multi-lang-build register claude
# 注册到全局配置
multi-lang-build register claude --global
注册其他 IDE
# 注册到 OpenCode
multi-lang-build register opencode
# 注册到 Trae
multi-lang-build register trae
# 注册到 CodeBuddy
multi-lang-build register codebuddy
注册功能说明
注册命令会将 skill 配置添加到指定 IDE 的配置目录:
| IDE | 命令 | 项目级配置 | 全局配置 |
|---|---|---|---|
| 🤖 Claude Code | multi-lang-build register |
.claude/multi-lang-build.md |
~/.claude/CLAUDE.md |
| 💠 OpenCode | multi-lang-build register opencode |
.opencode/skills.json |
~/.config/opencode/skills.json |
| 🔷 Trae | multi-lang-build register trae |
.trae/skills.json |
~/.trae/skills.json |
| 🎯 CodeBuddy | multi-lang-build register codebuddy |
.codebuddy/skills.yaml |
~/.codebuddy/skills.yaml |
注册后,IDE 将自动识别项目类型并提供智能构建建议。
📦 安装
使用 pip 安装
# 基础安装
pip install multi-lang-build
# 开发环境(包含测试工具)
pip install multi-lang-build[dev]
系统要求
- Python 3.11+
- 对应语言的构建工具:
- Go:
go命令 - Python:
python3和pip - PNPM:
pnpm和node
- Go:
📚 详细文档
| 语言 | 文档 | 说明 |
|---|---|---|
| 🐹 Go | go.md | 多入口编译、交叉编译、target 参数详解 |
| 🐍 Python | python.md | 依赖管理、虚拟环境、构建系统检测 |
| 📦 PNPM | pnpm.md | 项目根目录检测、Monorepo 支持、镜像配置 |
🛠️ CLI 命令行
# Go 项目构建(默认实时输出日志)
go-build ./myproject --output ./bin/app --target server.go --mirror
# 禁用实时输出
go-build ./myproject --output ./bin/app --no-stream
# Python 项目构建
python-build ./myproject --output ./dist --mirror
# PNPM 项目构建
pnpm-build ./myproject --output ./dist --mirror
# 注册到 IDE(默认 Claude Code)
multi-lang-build register
# 注册到指定 IDE
multi-lang-build register opencode
multi-lang-build register trae
multi-lang-build register codebuddy
# 镜像配置
multi-lang-build mirror list # 列出可用镜像
multi-lang-build mirror set pip # 配置 pip 镜像
multi-lang-build mirror set go # 配置 Go 代理
multi-lang-build mirror show # 查看当前配置
🌟 核心特性对比
| 特性 | GoCompiler | PythonCompiler | PnpmCompiler |
|---|---|---|---|
| 自动检测项目 | ✅ go.mod | ✅ pyproject.toml/setup.py | ✅ package.json |
| 多入口支持 | ✅ target 参数 |
❌ | ✅ 自动检测 |
| 镜像加速 | ✅ goproxy.cn | ✅ 清华/阿里云等 | ✅ npmmirror |
| CLI 支持 | ✅ go-build | ✅ python-build | ✅ pnpm-build |
| 类型安全 | ✅ Type Hints | ✅ Type Hints | ✅ Type Hints |
📝 示例项目
Go 多入口项目
myproject/
├── go.mod
├── server.go # package main - API 服务
├── client.go # package main - CLI 工具
└── worker.go # package main - 后台任务
# 构建所有入口
compiler = GoCompiler()
entries = ["server.go", "client.go", "worker.go"]
for entry in entries:
name = entry.replace(".go", "")
compiler.build_binary(
source_dir=Path("./myproject"),
output_path=Path(f"./bin/{name}"),
target=entry
)
Python Poetry 项目
myproject/
├── pyproject.toml # Poetry 配置
├── poetry.lock
└── src/
└── mypackage/
# 一键安装依赖并构建
compiler = PythonCompiler()
compiler.install_dependencies(source_dir=Path("./myproject"), dev=True)
compiler.build(source_dir=Path("./myproject"), output_dir=Path("./dist"))
前端 Monorepo
monorepo/
├── package.json
├── pnpm-workspace.yaml
└── packages/
├── ui/
├── utils/
└── app/
# 批量构建所有包
compiler = PnpmCompiler()
for pkg in ["ui", "utils", "app"]:
compiler.build(
source_dir=Path(f"./packages/{pkg}"),
output_dir=Path(f"./packages/{pkg}/dist")
)
🤝 贡献
欢迎提交 Issue 和 Pull Request!
📄 许可证
MIT © Multi-Lang Build Team
用 ❤️ 构建 | 让多语言开发更简单
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
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 multi_lang_build-0.2.5.tar.gz.
File metadata
- Download URL: multi_lang_build-0.2.5.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6644d97b95d87c4b1e9ddbf50e576e9f18f488db6b5e512a5d68d7c611b1ba1
|
|
| MD5 |
f3b40e3e0482ebccaebda72b51d78f79
|
|
| BLAKE2b-256 |
c3f0168086e0301435653b4aa5f74417cbbfbe6687d62826871665200ff1ad9b
|
File details
Details for the file multi_lang_build-0.2.5-py3-none-any.whl.
File metadata
- Download URL: multi_lang_build-0.2.5-py3-none-any.whl
- Upload date:
- Size: 34.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a602c71577d27d7908733cd09706f03a46b79f242d98cc875a69f54f1d3d41d
|
|
| MD5 |
085e03cc7390a182740562629770361e
|
|
| BLAKE2b-256 |
3dddec91b6fee48e77655cc0f48f325ffcec61f18f5d8a0188d98fa21d41eb97
|