Libra Boot Low
Libra 家族
| 仓库 | 定位 |
|---|---|
| libra-boot-plus | Java 微服务框架(SB3/Java17,starter 体系+业务模块+统一启动容器) |
| libra-boot-low · PyPI | Python 低代码生成器(YAML+Jinja2 一键生成全栈骨架,产物 SB3 合规) |
| libra-spring-boot-starter-toolkit | Java 8 静态工具箱(数据库/HTTP/Redis 三大件,独立 v1.0.32) |
| libra-boot-app | 全栈应用(Spring Boot+Vue,家族落地实例) |
| libra-boot-mp | 小程序/多端模块 |
基于 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.1.2-py3-none-any.whl |
✅ 现可用 |
| git 直装 | pip install git+https://github.com/halavah/libra-boot-low.git |
✅ 现可用 |
| PyPI | pip install libra-boot-low |
✅ 已上架 v1.1.1(Trusted Publishing 自动发布,推 v* 标签即出新版) |
生成链路
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"
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.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| libra_boot_low-1.1.2.tar.gz | 56.2 kB | With provenance | Details for libra_boot_low-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| libra_boot_low-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for libra_boot_low-1.1.2-py3-none-any.whl |
Total release size: 141.7 kB
Release files / libra_boot_low-1.1.2.tar.gz
| Download URL | libra_boot_low-1.1.2.tar.gz |
|---|---|
| Size | 56.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0081911c56761ab46376d3ef829bbb5a3280b573b79649e49a72eaa76b3998e6
|
|
BLAKE2b-256 checksum How to use checksums |
5029cb318cc4f0eedbfd15b7fca48e44c29eb61c8d647a55b8aef17a08c8980d
|
| 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 logRelease files / libra_boot_low-1.1.2-py3-none-any.whl
| Download URL | libra_boot_low-1.1.2-py3-none-any.whl |
|---|---|
| Size | 85.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bf1c86a3980db1f1ad42513d7b8c37a2dd481033b250d525da5156396664e63
|
|
BLAKE2b-256 checksum How to use checksums |
3fac1cdf4a40def0715820723e0530c7f29ee881d5c5da74abb43931810c8410
|
| 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 logSecurity for libra-boot-low 1.1.2
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.
Attestation for libra_boot_low-1.1.2.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 logA 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.