Skip to main content

Libra Boot Low

基于 YAML 配置 + Jinja2 模板的低代码代码生成器,一键生成 Spring Boot + Vue3 完整业务骨架代码,覆盖后端(Java)、前端(Vue3)、SQL 建表、HTTP 测试脚本全产物链路。

快速上手

# 方式一:直接从源码运行
pip install -r requirements.txt

# 使用示例配置生成
python3 generator.py config/test/t1000.yml

# 或使用交互式菜单
bash run.sh

# 批量生成全部模块
bash run.sh --all

安装

通道 命令 状态
源码直跑 pip install -r requirements.txt 后 python3 generator.py ✅ 现可用
GitHub Release wheel pip install https://github.com/halavah/libra-boot-low/releases/latest/download/libra_boot_low-1.2.0-py3-none-any.whl ✅ 现可用
git 直装 pip install git+https://github.com/halavah/libra-boot-low.git 🔒 内网(需克隆权限)
PyPI pip install libra-boot-low ✅ 已上架(Trusted Publishing 自动发布,推 v* 标签即出新版;最新版见 PyPI 页面)

生成链路

YAML 配置  ──►  generator.py  ──►  module/gen_*.py  ──►  templates/{mode}/  ──►  out/{domain}/{code}/
  (yml/)         (主入口)          (模式生成器)         (Jinja2 模板)           (完整产物)

十二种生成模式

模式 说明 适用场景
single 单表 CRUD 简单业务表
single-with-file 单表 + 附件上传 带文件的业务表
multi-table 多表关联 主表带字典/配置表
multi-table-with-file 多表 + 附件 带文件的多表
master-detail 主从表(一对多) 订单-订单明细
master-detail-with-file 主从表 + 附件 带文件的主从
master-detail-modules 主从表(模块化) 子表独立成模块
master-detail-modules-with-file 主从模块化 + 附件 带文件的主从模块化
master-details-tabs 主多明细(页签) 一主多子页签切换
master-details-tabs-with-file 主多明细页签 + 附件 带文件的多明细
master-details-tabs-dialog 主多明细(页签弹窗) 弹窗编辑的复杂主从
master-details-tabs-dialog-with-file 页签弹窗 + 附件 带文件的页签弹窗

每种模式均有对应的 templates/{mode}/ 模板目录和 config/test/ 示例配置。

生成产物

每个模块按六段编号生成完整产物链:

out/{domain}/{code}/
├── 00-inbox/ 01-design/      # 生成物清单 + 设计说明
├── 02-sql/ 02-sql-scripts/   # 建表 DDL + SQL 执行脚本
├── 03-http/ 03-http-scripts/ # HTTP 接口测试用例 + 运行脚本
├── 04-server/                # Spring Boot 后端
│   ├── controller/ service/ mapper/  # 控制器/业务/MyBatis 数据层
│   └── entity/{param,po,vo}/         # 实体三件套
└── 05-web/                   # Vue3 前端
    ├── views/                # 页面组件
    └── service/              # API 调用

配置示例

# config/test/t1000.yml(节选——完整注释见该文件)
project:
  name: "Libra Boot Low"
  code: "demo"          # 项目编码(英文小写)
  version: "1.0.0"
  group: "com.libra"   # 生成代码包前缀(可配置,默认 com.libra)

modules:
  - name: "单表无附件"   # 模块中文名
    code: "t1000"       # 模块编码(英文小写)
    domain: "test"      # 业务域编码
    mode: "single"      # 生成模式(12 种之一)
    fields:             # 字段清单(type 决定 Java/SQL/Vue 三端类型)
      - { name: "title", label: "标题", type: "input", required: true }
      - { name: "status", label: "状态", type: "select" }
      - { name: "createTime", label: "创建时间", type: "date-year" }

测试

pip install pytest
python -m pytest tests/ -q   # 12 用例:配置加载/类型转换/DRY_RUN 零落盘/渲染器/单表产物结构

CLI 参数

generator.py 参数:

参数 说明
config(位置参数) YAML 配置文件路径
output(位置参数) 输出目录(默认 ../../out)
--module <code> / -m 仅生成指定 code 的模块
--mode <mode> 覆盖 YAML 中的 mode
--validate / -v 仅校验配置,不生成
--list / -l 列出配置内的模块
--list-modes 列出全部 12 种支持的模式
--dry-run 预览将生成的文件列表,零落盘
--update-index / -u 仅重建 config/index.json 索引
--batch-timestamp <ts> 批量模式共享日志时间戳
--version 显示版本号

run.sh / run.ps1 启动器额外提供: 交互式菜单(无参数运行)、--all(批量生成全部模块)、--domain <name>(按域过滤)——由启动器循环调用 generator.py 实现。

技术栈

组件 说明
Python 3.9+ 运行环境
PyYAML 配置解析
Jinja2 模板渲染

项目结构

libra-boot-low/
├── generator.py            # 主入口
├── run.sh                  # Shell 交互式菜单
├── run.ps1                 # PowerShell 交互式菜单
├── module/                 # 核心生成模块
│   ├── config_loader.py    # YAML 配置加载
│   ├── field_builder.py    # 字段构建器
│   ├── template_renderer.py # Jinja2 渲染器
│   └── gen_*.py            # 各模式生成器
├── templates/              # Jinja2 模板(12 种模式)
│   ├── single/
│   ├── single-with-file/
│   ├── multi-table/
│   ├── master-detail/
│   └── ...
├── config/                 # YAML 配置文件
│   ├── README.md           # 配置说明
│   └── test/               # 示例配置

License

MIT

Metadata

Release files for libra-boot-low 1.2.0

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

Source distribution (sdist)

Source distribution for libra-boot-low 1.2.0
File Size Uploaded Provenance Actions
libra_boot_low-1.2.0.tar.gz 56.1 kB With provenance Details for libra_boot_low-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for libra-boot-low 1.2.0
File Interpreter ABI Platform Actions
libra_boot_low-1.2.0-py3-none-any.whl Python 3 none any Details for libra_boot_low-1.2.0-py3-none-any.whl

Total release size: 141.6 kB

Release files / libra_boot_low-1.2.0.tar.gz

Download URL libra_boot_low-1.2.0.tar.gz
Size 56.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e36a4196bb4636ea80bc0c35c946e9502d291eeb85bcc38bd0dff5d964750bbc
BLAKE2b-256 checksum
How to use checksums
b7e9a9485ec20ee4165e543be2091da3ed054f569b82b8c46377beff8409a7e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / libra_boot_low-1.2.0-py3-none-any.whl

Download URL libra_boot_low-1.2.0-py3-none-any.whl
Size 85.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
960b683cbcdcfacece736deb8c596abe00a63e1868a59945b64a6e1f976b4466
BLAKE2b-256 checksum
How to use checksums
cc1f0ae919069332f7f1ae377eff3cd17256af7dcc237d78fdd3b2ee77a4a2ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for libra-boot-low 1.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for libra_boot_low-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

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.

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