libra-boot-low 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. libra_boot_low-1.1.1/LICENSE +21 -0
  2. libra_boot_low-1.1.1/PKG-INFO +180 -0
  3. libra_boot_low-1.1.1/README.md +159 -0
  4. libra_boot_low-1.1.1/generator.py +930 -0
  5. libra_boot_low-1.1.1/libra_boot_low.egg-info/PKG-INFO +180 -0
  6. libra_boot_low-1.1.1/libra_boot_low.egg-info/SOURCES.txt +33 -0
  7. libra_boot_low-1.1.1/libra_boot_low.egg-info/dependency_links.txt +1 -0
  8. libra_boot_low-1.1.1/libra_boot_low.egg-info/entry_points.txt +2 -0
  9. libra_boot_low-1.1.1/libra_boot_low.egg-info/requires.txt +2 -0
  10. libra_boot_low-1.1.1/libra_boot_low.egg-info/top_level.txt +2 -0
  11. libra_boot_low-1.1.1/module/__init__.py +19 -0
  12. libra_boot_low-1.1.1/module/analyze_optional_context.py +311 -0
  13. libra_boot_low-1.1.1/module/config_loader.py +686 -0
  14. libra_boot_low-1.1.1/module/field_builder.py +569 -0
  15. libra_boot_low-1.1.1/module/gen_master_detail.py +314 -0
  16. libra_boot_low-1.1.1/module/gen_master_detail_file.py +391 -0
  17. libra_boot_low-1.1.1/module/gen_master_detail_modules.py +382 -0
  18. libra_boot_low-1.1.1/module/gen_master_detail_modules_file.py +428 -0
  19. libra_boot_low-1.1.1/module/gen_master_details_tabs.py +403 -0
  20. libra_boot_low-1.1.1/module/gen_master_details_tabs_dialog.py +403 -0
  21. libra_boot_low-1.1.1/module/gen_master_details_tabs_dialog_file.py +413 -0
  22. libra_boot_low-1.1.1/module/gen_master_details_tabs_file.py +414 -0
  23. libra_boot_low-1.1.1/module/gen_multi_table.py +265 -0
  24. libra_boot_low-1.1.1/module/gen_multi_table_with_file.py +275 -0
  25. libra_boot_low-1.1.1/module/gen_single.py +90 -0
  26. libra_boot_low-1.1.1/module/gen_single_with_file.py +91 -0
  27. libra_boot_low-1.1.1/module/master_detail_utils.py +280 -0
  28. libra_boot_low-1.1.1/module/template_renderer.py +527 -0
  29. libra_boot_low-1.1.1/pyproject.toml +32 -0
  30. libra_boot_low-1.1.1/setup.cfg +4 -0
  31. libra_boot_low-1.1.1/tests/test_config_loader.py +31 -0
  32. libra_boot_low-1.1.1/tests/test_dry_run.py +18 -0
  33. libra_boot_low-1.1.1/tests/test_field_builder.py +21 -0
  34. libra_boot_low-1.1.1/tests/test_gen_single.py +28 -0
  35. libra_boot_low-1.1.1/tests/test_renderer.py +21 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 halavah
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: libra-boot-low
3
+ Version: 1.1.1
4
+ Summary: Low-code generator: YAML + Jinja2 templates producing full-stack Spring Boot + Vue3 scaffolding (backend/frontend/SQL/HTTP tests)
5
+ Author: halavah
6
+ License: MIT
7
+ Keywords: low-code,code-generator,jinja2,spring-boot,vue3,scaffolding
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Software Development :: Code Generators
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: PyYAML>=5.4
19
+ Requires-Dist: Jinja2>=2.11
20
+ Dynamic: license-file
21
+
22
+ # Libra Boot Low
23
+
24
+ ## Libra 家族
25
+
26
+ | 仓库 | 定位 |
27
+ |------|------|
28
+ | [libra-boot-plus](https://github.com/halavah/libra-boot-plus) | Java 微服务框架(SB3/Java17,starter 体系+业务模块+统一启动容器) |
29
+ | [libra-boot-low](https://github.com/halavah/libra-boot-low) | Python 低代码生成器(YAML+Jinja2 一键生成全栈骨架,产物 SB3 合规) |
30
+ | [libra-spring-boot-starter-toolkit](https://github.com/halavah/libra-spring-boot-starter-toolkit) | Java 8 静态工具箱(数据库/HTTP/Redis 三大件,独立 v1.0.32) |
31
+
32
+ 基于 **YAML 配置 + Jinja2 模板**的低代码代码生成器,一键生成 Spring Boot + Vue3 完整业务骨架代码,覆盖后端(Java)、前端(Vue3)、SQL 建表、HTTP 测试脚本全产物链路。
33
+
34
+ ## 快速上手
35
+
36
+ ```bash
37
+ # 方式一:直接从源码运行
38
+ pip install -r requirements.txt
39
+
40
+ # 使用示例配置生成
41
+ python3 generator.py config/test/t1000.yml
42
+
43
+ # 或使用交互式菜单
44
+ bash run.sh
45
+
46
+ # 批量生成全部模块
47
+ bash run.sh --all
48
+ ```
49
+
50
+ ## 安装
51
+
52
+ | 通道 | 命令 | 状态 |
53
+ |---|---|---|
54
+ | 源码直跑 | `pip install -r requirements.txt` 后 `python3 generator.py` | ✅ 现可用 |
55
+ | GitHub Release wheel | `pip install https://github.com/halavah/libra-boot-low/releases/latest/download/libra_boot_low-1.1.0-py3-none-any.whl` | ✅ 现可用 |
56
+ | git 直装 | `pip install git+https://github.com/halavah/libra-boot-low.git` | ✅ 现可用 |
57
+ | PyPI | `pip install libra-boot-low` | 🚧 Trusted Publishing 待项目页配置后自动开通 |
58
+
59
+ ## 生成链路
60
+
61
+ ```
62
+ YAML 配置 ──► generator.py ──► module/gen_*.py ──► templates/{mode}/ ──► out/{domain}/{code}/
63
+ (yml/) (主入口) (模式生成器) (Jinja2 模板) (完整产物)
64
+ ```
65
+
66
+ ## 十二种生成模式
67
+
68
+ | 模式 | 说明 | 适用场景 |
69
+ |------|------|---------|
70
+ | `single` | 单表 CRUD | 简单业务表 |
71
+ | `single-with-file` | 单表 + 附件上传 | 带文件的业务表 |
72
+ | `multi-table` | 多表关联 | 主表带字典/配置表 |
73
+ | `multi-table-with-file` | 多表 + 附件 | 带文件的多表 |
74
+ | `master-detail` | 主从表(一对多) | 订单-订单明细 |
75
+ | `master-detail-with-file` | 主从表 + 附件 | 带文件的主从 |
76
+ | `master-detail-modules` | 主从表(模块化) | 子表独立成模块 |
77
+ | `master-detail-modules-with-file` | 主从模块化 + 附件 | 带文件的主从模块化 |
78
+ | `master-details-tabs` | 主多明细(页签) | 一主多子页签切换 |
79
+ | `master-details-tabs-with-file` | 主多明细页签 + 附件 | 带文件的多明细 |
80
+ | `master-details-tabs-dialog` | 主多明细(页签弹窗) | 弹窗编辑的复杂主从 |
81
+ | `master-details-tabs-dialog-with-file` | 页签弹窗 + 附件 | 带文件的页签弹窗 |
82
+
83
+ 每种模式均有对应的 `templates/{mode}/` 模板目录和 `config/test/` 示例配置。
84
+
85
+ ## 生成产物
86
+
87
+ 每个模块按六段编号生成完整产物链:
88
+
89
+ ```
90
+ out/{domain}/{code}/
91
+ ├── 00-inbox/ 01-design/ # 生成物清单 + 设计说明
92
+ ├── 02-sql/ 02-sql-scripts/ # 建表 DDL + SQL 执行脚本
93
+ ├── 03-http/ 03-http-scripts/ # HTTP 接口测试用例 + 运行脚本
94
+ ├── 04-server/ # Spring Boot 后端
95
+ │ ├── controller/ service/ mapper/ # 控制器/业务/MyBatis 数据层
96
+ │ └── entity/{param,po,vo}/ # 实体三件套
97
+ └── 05-web/ # Vue3 前端
98
+ ├── views/ # 页面组件
99
+ └── service/ # API 调用
100
+ ```
101
+
102
+ ## 配置示例
103
+
104
+ ```yaml
105
+ # config/test/t1000.yml(节选——完整注释见该文件)
106
+ project:
107
+ name: "Libra Boot Low"
108
+ code: "demo" # 项目编码(英文小写)
109
+ version: "1.0.0"
110
+
111
+ modules:
112
+ - name: "单表无附件" # 模块中文名
113
+ code: "t1000" # 模块编码(英文小写)
114
+ domain: "test" # 业务域编码
115
+ mode: "single" # 生成模式(12 种之一)
116
+ fields: # 字段清单(type 决定 Java/SQL/Vue 三端类型)
117
+ - { name: "title", label: "标题", type: "input", required: true }
118
+ - { name: "status", label: "状态", type: "select" }
119
+ - { name: "createTime", label: "创建时间", type: "date-year" }
120
+ ```
121
+
122
+ ## CLI 参数
123
+
124
+ **generator.py 参数:**
125
+
126
+ | 参数 | 说明 |
127
+ |------|------|
128
+ | `config`(位置参数) | YAML 配置文件路径 |
129
+ | `output`(位置参数) | 输出目录(默认 `../../out`) |
130
+ | `--module <code>` / `-m` | 仅生成指定 code 的模块 |
131
+ | `--mode <mode>` | 覆盖 YAML 中的 mode |
132
+ | `--validate` / `-v` | 仅校验配置,不生成 |
133
+ | `--list` / `-l` | 列出配置内的模块 |
134
+ | `--list-modes` | 列出全部 12 种支持的模式 |
135
+ | `--dry-run` | 预览将生成的文件列表,零落盘 |
136
+ | `--update-index` / `-u` | 仅重建 config/index.json 索引 |
137
+ | `--batch-timestamp <ts>` | 批量模式共享日志时间戳 |
138
+ | `--version` | 显示版本号 |
139
+
140
+ **run.sh / run.ps1 启动器额外提供:** 交互式菜单(无参数运行)、`--all`(批量生成全部模块)、`--domain <name>`(按域过滤)——由启动器循环调用 generator.py 实现。
141
+
142
+ ## 技术栈
143
+
144
+ | 组件 | 说明 |
145
+ |------|------|
146
+ | Python 3.9+ | 运行环境 |
147
+ | PyYAML | 配置解析 |
148
+ | Jinja2 | 模板渲染 |
149
+
150
+ ## 项目结构
151
+
152
+ ```
153
+ libra-boot-low/
154
+ ├── generator.py # 主入口
155
+ ├── run.sh # Shell 交互式菜单
156
+ ├── run.ps1 # PowerShell 交互式菜单
157
+ ├── module/ # 核心生成模块
158
+ │ ├── config_loader.py # YAML 配置加载
159
+ │ ├── field_builder.py # 字段构建器
160
+ │ ├── template_renderer.py # Jinja2 渲染器
161
+ │ └── gen_*.py # 各模式生成器
162
+ ├── templates/ # Jinja2 模板(12 种模式)
163
+ │ ├── single/
164
+ │ ├── single-with-file/
165
+ │ ├── multi-table/
166
+ │ ├── master-detail/
167
+ │ └── ...
168
+ ├── config/ # YAML 配置文件
169
+ │ ├── README.md # 配置说明
170
+ │ └── test/ # 示例配置
171
+ ```
172
+
173
+ ## License
174
+
175
+ MIT
176
+
177
+ ## 相关项目
178
+
179
+ - [libra-boot-plus](https://github.com/halavah/libra-boot-plus) — Spring Boot 微服务架构框架
180
+ - [libra-spring-boot-starter-toolkit](https://github.com/halavah/libra-spring-boot-starter-toolkit) — Java 静态工具包
@@ -0,0 +1,159 @@
1
+ # Libra Boot Low
2
+
3
+ ## Libra 家族
4
+
5
+ | 仓库 | 定位 |
6
+ |------|------|
7
+ | [libra-boot-plus](https://github.com/halavah/libra-boot-plus) | Java 微服务框架(SB3/Java17,starter 体系+业务模块+统一启动容器) |
8
+ | [libra-boot-low](https://github.com/halavah/libra-boot-low) | Python 低代码生成器(YAML+Jinja2 一键生成全栈骨架,产物 SB3 合规) |
9
+ | [libra-spring-boot-starter-toolkit](https://github.com/halavah/libra-spring-boot-starter-toolkit) | Java 8 静态工具箱(数据库/HTTP/Redis 三大件,独立 v1.0.32) |
10
+
11
+ 基于 **YAML 配置 + Jinja2 模板**的低代码代码生成器,一键生成 Spring Boot + Vue3 完整业务骨架代码,覆盖后端(Java)、前端(Vue3)、SQL 建表、HTTP 测试脚本全产物链路。
12
+
13
+ ## 快速上手
14
+
15
+ ```bash
16
+ # 方式一:直接从源码运行
17
+ pip install -r requirements.txt
18
+
19
+ # 使用示例配置生成
20
+ python3 generator.py config/test/t1000.yml
21
+
22
+ # 或使用交互式菜单
23
+ bash run.sh
24
+
25
+ # 批量生成全部模块
26
+ bash run.sh --all
27
+ ```
28
+
29
+ ## 安装
30
+
31
+ | 通道 | 命令 | 状态 |
32
+ |---|---|---|
33
+ | 源码直跑 | `pip install -r requirements.txt` 后 `python3 generator.py` | ✅ 现可用 |
34
+ | GitHub Release wheel | `pip install https://github.com/halavah/libra-boot-low/releases/latest/download/libra_boot_low-1.1.0-py3-none-any.whl` | ✅ 现可用 |
35
+ | git 直装 | `pip install git+https://github.com/halavah/libra-boot-low.git` | ✅ 现可用 |
36
+ | PyPI | `pip install libra-boot-low` | 🚧 Trusted Publishing 待项目页配置后自动开通 |
37
+
38
+ ## 生成链路
39
+
40
+ ```
41
+ YAML 配置 ──► generator.py ──► module/gen_*.py ──► templates/{mode}/ ──► out/{domain}/{code}/
42
+ (yml/) (主入口) (模式生成器) (Jinja2 模板) (完整产物)
43
+ ```
44
+
45
+ ## 十二种生成模式
46
+
47
+ | 模式 | 说明 | 适用场景 |
48
+ |------|------|---------|
49
+ | `single` | 单表 CRUD | 简单业务表 |
50
+ | `single-with-file` | 单表 + 附件上传 | 带文件的业务表 |
51
+ | `multi-table` | 多表关联 | 主表带字典/配置表 |
52
+ | `multi-table-with-file` | 多表 + 附件 | 带文件的多表 |
53
+ | `master-detail` | 主从表(一对多) | 订单-订单明细 |
54
+ | `master-detail-with-file` | 主从表 + 附件 | 带文件的主从 |
55
+ | `master-detail-modules` | 主从表(模块化) | 子表独立成模块 |
56
+ | `master-detail-modules-with-file` | 主从模块化 + 附件 | 带文件的主从模块化 |
57
+ | `master-details-tabs` | 主多明细(页签) | 一主多子页签切换 |
58
+ | `master-details-tabs-with-file` | 主多明细页签 + 附件 | 带文件的多明细 |
59
+ | `master-details-tabs-dialog` | 主多明细(页签弹窗) | 弹窗编辑的复杂主从 |
60
+ | `master-details-tabs-dialog-with-file` | 页签弹窗 + 附件 | 带文件的页签弹窗 |
61
+
62
+ 每种模式均有对应的 `templates/{mode}/` 模板目录和 `config/test/` 示例配置。
63
+
64
+ ## 生成产物
65
+
66
+ 每个模块按六段编号生成完整产物链:
67
+
68
+ ```
69
+ out/{domain}/{code}/
70
+ ├── 00-inbox/ 01-design/ # 生成物清单 + 设计说明
71
+ ├── 02-sql/ 02-sql-scripts/ # 建表 DDL + SQL 执行脚本
72
+ ├── 03-http/ 03-http-scripts/ # HTTP 接口测试用例 + 运行脚本
73
+ ├── 04-server/ # Spring Boot 后端
74
+ │ ├── controller/ service/ mapper/ # 控制器/业务/MyBatis 数据层
75
+ │ └── entity/{param,po,vo}/ # 实体三件套
76
+ └── 05-web/ # Vue3 前端
77
+ ├── views/ # 页面组件
78
+ └── service/ # API 调用
79
+ ```
80
+
81
+ ## 配置示例
82
+
83
+ ```yaml
84
+ # config/test/t1000.yml(节选——完整注释见该文件)
85
+ project:
86
+ name: "Libra Boot Low"
87
+ code: "demo" # 项目编码(英文小写)
88
+ version: "1.0.0"
89
+
90
+ modules:
91
+ - name: "单表无附件" # 模块中文名
92
+ code: "t1000" # 模块编码(英文小写)
93
+ domain: "test" # 业务域编码
94
+ mode: "single" # 生成模式(12 种之一)
95
+ fields: # 字段清单(type 决定 Java/SQL/Vue 三端类型)
96
+ - { name: "title", label: "标题", type: "input", required: true }
97
+ - { name: "status", label: "状态", type: "select" }
98
+ - { name: "createTime", label: "创建时间", type: "date-year" }
99
+ ```
100
+
101
+ ## CLI 参数
102
+
103
+ **generator.py 参数:**
104
+
105
+ | 参数 | 说明 |
106
+ |------|------|
107
+ | `config`(位置参数) | YAML 配置文件路径 |
108
+ | `output`(位置参数) | 输出目录(默认 `../../out`) |
109
+ | `--module <code>` / `-m` | 仅生成指定 code 的模块 |
110
+ | `--mode <mode>` | 覆盖 YAML 中的 mode |
111
+ | `--validate` / `-v` | 仅校验配置,不生成 |
112
+ | `--list` / `-l` | 列出配置内的模块 |
113
+ | `--list-modes` | 列出全部 12 种支持的模式 |
114
+ | `--dry-run` | 预览将生成的文件列表,零落盘 |
115
+ | `--update-index` / `-u` | 仅重建 config/index.json 索引 |
116
+ | `--batch-timestamp <ts>` | 批量模式共享日志时间戳 |
117
+ | `--version` | 显示版本号 |
118
+
119
+ **run.sh / run.ps1 启动器额外提供:** 交互式菜单(无参数运行)、`--all`(批量生成全部模块)、`--domain <name>`(按域过滤)——由启动器循环调用 generator.py 实现。
120
+
121
+ ## 技术栈
122
+
123
+ | 组件 | 说明 |
124
+ |------|------|
125
+ | Python 3.9+ | 运行环境 |
126
+ | PyYAML | 配置解析 |
127
+ | Jinja2 | 模板渲染 |
128
+
129
+ ## 项目结构
130
+
131
+ ```
132
+ libra-boot-low/
133
+ ├── generator.py # 主入口
134
+ ├── run.sh # Shell 交互式菜单
135
+ ├── run.ps1 # PowerShell 交互式菜单
136
+ ├── module/ # 核心生成模块
137
+ │ ├── config_loader.py # YAML 配置加载
138
+ │ ├── field_builder.py # 字段构建器
139
+ │ ├── template_renderer.py # Jinja2 渲染器
140
+ │ └── gen_*.py # 各模式生成器
141
+ ├── templates/ # Jinja2 模板(12 种模式)
142
+ │ ├── single/
143
+ │ ├── single-with-file/
144
+ │ ├── multi-table/
145
+ │ ├── master-detail/
146
+ │ └── ...
147
+ ├── config/ # YAML 配置文件
148
+ │ ├── README.md # 配置说明
149
+ │ └── test/ # 示例配置
150
+ ```
151
+
152
+ ## License
153
+
154
+ MIT
155
+
156
+ ## 相关项目
157
+
158
+ - [libra-boot-plus](https://github.com/halavah/libra-boot-plus) — Spring Boot 微服务架构框架
159
+ - [libra-spring-boot-starter-toolkit](https://github.com/halavah/libra-spring-boot-starter-toolkit) — Java 静态工具包