faster-app 0.0.5__py3-none-any.whl → 0.0.7__py3-none-any.whl
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.
- faster_app/__init__.py +1 -1
- faster_app/commands/base.py +3 -0
- faster_app/commands/builtins/app.py +38 -0
- faster_app/commands/builtins/db.py +1 -0
- faster_app/settings/builtins/settings.py +1 -1
- faster_app/statics/swagger-ui-bundle.min.js +1 -1
- faster_app/templates/apps/demo/commands.py +16 -0
- faster_app/templates/apps/demo/models.py +13 -0
- faster_app/templates/apps/demo/routes.py +13 -0
- faster_app/templates/config/settings.py +9 -0
- {faster_app-0.0.5.dist-info → faster_app-0.0.7.dist-info}/METADATA +3 -16
- {faster_app-0.0.5.dist-info → faster_app-0.0.7.dist-info}/RECORD +15 -10
- {faster_app-0.0.5.dist-info → faster_app-0.0.7.dist-info}/WHEEL +0 -0
- {faster_app-0.0.5.dist-info → faster_app-0.0.7.dist-info}/licenses/LICENSE +0 -0
- {faster_app-0.0.5.dist-info → faster_app-0.0.7.dist-info}/top_level.txt +0 -0
faster_app/__init__.py
CHANGED
faster_app/commands/base.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
命令基类, 使用 fire 库管理子命令
|
3
3
|
"""
|
4
4
|
|
5
|
+
import os
|
5
6
|
import inspect
|
6
7
|
from functools import wraps
|
7
8
|
from tortoise import Tortoise
|
@@ -30,6 +31,8 @@ def with_db_init(func):
|
|
30
31
|
class CommandBase(object):
|
31
32
|
"""命令基类"""
|
32
33
|
|
34
|
+
BASE_PATH = os.path.dirname(os.path.dirname(__file__))
|
35
|
+
|
33
36
|
# 默认要去掉的后缀列表
|
34
37
|
DEFAULT_SUFFIXES = [
|
35
38
|
"Command",
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import os
|
2
|
+
import shutil
|
3
|
+
from faster_app.commands.base import CommandBase
|
4
|
+
from rich.console import Console
|
5
|
+
|
6
|
+
console = Console()
|
7
|
+
|
8
|
+
|
9
|
+
class AppCommand(CommandBase):
|
10
|
+
"""App Command"""
|
11
|
+
|
12
|
+
async def init(self):
|
13
|
+
"""Run Init App"""
|
14
|
+
# 拷贝项目根路径下的 main.py 文件到项目根路径
|
15
|
+
shutil.copy(f"{self.BASE_PATH}/main.py", "main.py")
|
16
|
+
console.print("✅ main.py created successfully")
|
17
|
+
|
18
|
+
# 拷贝项目根路径下的 .env.example 文件到项目根路径
|
19
|
+
shutil.copy(f"{self.BASE_PATH}/.env.example", ".env")
|
20
|
+
console.print("✅ .env created successfully")
|
21
|
+
|
22
|
+
async def demo(self):
|
23
|
+
"""Run Demo"""
|
24
|
+
# 项目根路径下创建 apps 目录,如果存在则跳过
|
25
|
+
if not os.path.exists("apps"):
|
26
|
+
os.makedirs("apps")
|
27
|
+
# 拷贝 templates/apps/demo 目录到 apps 目录
|
28
|
+
shutil.copytree(f"{self.BASE_PATH}/templates/apps/demo", "apps/demo")
|
29
|
+
|
30
|
+
async def config(self):
|
31
|
+
"""Run Config"""
|
32
|
+
# 项目根路径下创建 config 目录,如果存在则跳过
|
33
|
+
if not os.path.exists("config"):
|
34
|
+
os.makedirs("config")
|
35
|
+
# 拷贝 templates/config/settings.py 到 config 目录
|
36
|
+
shutil.copytree(
|
37
|
+
f"{self.BASE_PATH}/templates/config/settings.py", "config/settings.py"
|
38
|
+
)
|
@@ -31826,7 +31826,7 @@ ${u.current.stack}
|
|
31826
31826
|
return !(
|
31827
31827
|
!e ||
|
31828
31828
|
0 <= r()(e).call(e, "localhost") ||
|
31829
|
-
0 <= r()(e).call(e, "127.0.0.
|
31829
|
+
0 <= r()(e).call(e, "127.0.0.7") ||
|
31830
31830
|
"none" === e
|
31831
31831
|
);
|
31832
31832
|
},
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import time
|
2
|
+
from faster_app.commands.base import CommandBase
|
3
|
+
from rich.console import Console
|
4
|
+
from rich.progress import track
|
5
|
+
|
6
|
+
console = Console()
|
7
|
+
|
8
|
+
|
9
|
+
class DemoCommand(CommandBase):
|
10
|
+
"""Demo App Commands"""
|
11
|
+
|
12
|
+
async def run(self):
|
13
|
+
console.print("[i]Hello[/i] ABC", style="bold green")
|
14
|
+
for step in track(range(50)):
|
15
|
+
time.sleep(0.1)
|
16
|
+
console.print(f"[progress.description]{step}[/progress.description]")
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from tortoise import fields
|
2
|
+
from faster_app.models import UUIDModel, DateTimeModel, StatusModel
|
3
|
+
|
4
|
+
|
5
|
+
class DemoModel(UUIDModel, DateTimeModel, StatusModel):
|
6
|
+
name = fields.CharField(max_length=255)
|
7
|
+
|
8
|
+
class Meta:
|
9
|
+
table = "demo"
|
10
|
+
table_description = "Demo Model"
|
11
|
+
|
12
|
+
def __str__(self):
|
13
|
+
return self.name
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from fastapi import APIRouter
|
2
|
+
from pydantic import BaseModel
|
3
|
+
|
4
|
+
router = APIRouter(prefix="/demo", tags=["demo"])
|
5
|
+
|
6
|
+
|
7
|
+
class DemoRequest(BaseModel):
|
8
|
+
name: str
|
9
|
+
|
10
|
+
|
11
|
+
@router.post("/")
|
12
|
+
async def get_demo(request: DemoRequest):
|
13
|
+
return {"message": f"Hello, {request.name}!"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: faster_app
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.7
|
4
4
|
Summary: 一个轻量级的 Python Web 框架,提供自动发现、模型基类、命令行工具等功能
|
5
5
|
Author-email: peizhenfei <peizhenfei@hotmail.com>
|
6
6
|
Maintainer-email: peizhenfei <peizhenfei@hotmail.com>
|
@@ -201,7 +201,7 @@ class Settings(BaseSettings):
|
|
201
201
|
DEBUG: bool = True
|
202
202
|
|
203
203
|
# 服务器配置
|
204
|
-
HOST: str = "127.0.0.
|
204
|
+
HOST: str = "127.0.0.7"
|
205
205
|
PORT: int = 8000
|
206
206
|
|
207
207
|
# API 配置
|
@@ -267,19 +267,6 @@ SECRET_KEY=your-secret-key-here
|
|
267
267
|
- [Pydantic](https://pydantic-docs.helpmanual.io/) - 数据验证库
|
268
268
|
- [Rich](https://rich.readthedocs.io/) - 终端美化库
|
269
269
|
|
270
|
-
## 📈 更新日志
|
271
|
-
|
272
|
-
### v0.0.5 (2025-09-09)
|
273
|
-
|
274
|
-
- 🎉 初始版本发布
|
275
|
-
- ✅ 提供基础的自动发现功能
|
276
|
-
- ✅ 提供模型、命令、路由基类
|
277
|
-
- ✅ 提供数据库连接管理
|
278
|
-
- ✅ 内置数据库迁移工具
|
279
|
-
- ✅ 内置 FastAPI 开发服务器
|
280
|
-
|
281
|
-
---
|
282
|
-
|
283
270
|
**作者**: peizhenfei (peizhenfei@hotmail.com)
|
284
271
|
|
285
|
-
**项目主页**: [https://github.com/mautops/
|
272
|
+
**项目主页**: [https://github.com/mautops/faster-app.git](https://github.com/mautops/faster-app.git)
|
@@ -1,11 +1,12 @@
|
|
1
|
-
faster_app/__init__.py,sha256
|
1
|
+
faster_app/__init__.py,sha256=otT0KHe8jLGgcaeyOWJioVk7Y4GdwTfnGv88uvzfUNU,1425
|
2
2
|
faster_app/base.py,sha256=8350gBg_GkW_ww_lDvIOODFOJ71_yowQ5gd_tMTPrQ8,4035
|
3
3
|
faster_app/db.py,sha256=uG4k_eSy5C2MP7DF-senxI10sLAGrLkgmBRFfH_91kY,994
|
4
4
|
faster_app/commands/__init__.py,sha256=AgjI6NmKpdzNTH93XvXsvh54F7PiRX-MJq6emITw7K4,258
|
5
|
-
faster_app/commands/base.py,sha256=
|
5
|
+
faster_app/commands/base.py,sha256=c5wRPxIBEyJLgBTrFGGDUs4Xh4h9gMxFHlNOf6MgcMo,2544
|
6
6
|
faster_app/commands/discover.py,sha256=7pWETGJmRi6KDj-LcBLbmusKIvPElGFU6T92WvdRTew,620
|
7
7
|
faster_app/commands/builtins/__init__.py,sha256=Wi3YfjUhZ45VNh7SoLdtCATjAPbWjSwv0gpmFZGJMHA,27
|
8
|
-
faster_app/commands/builtins/
|
8
|
+
faster_app/commands/builtins/app.py,sha256=LIcFuk4Xy19dhNn2DpFS6Zd5tjmLCBszprpI9iUjTI0,1332
|
9
|
+
faster_app/commands/builtins/db.py,sha256=cGxa98VC-h1Wl725GUvcu1XYAtAwY6n3t_0pNa-fbho,4741
|
9
10
|
faster_app/commands/builtins/fastapi.py,sha256=QOdnt63V0PHRgjZvVLeZXbE94YaOc5uN39e4SmwPtwY,2392
|
10
11
|
faster_app/models/__init__.py,sha256=6Mn6zjxF0JJfhDik4LNaXDNLxGgdgl5ECBbqLvgkpxs,334
|
11
12
|
faster_app/models/base.py,sha256=XdWpXQTQDQWwBae8GVhKxwQIAIRwsHRBJ30gQr6ynCQ,2738
|
@@ -18,11 +19,15 @@ faster_app/routes/builtins/defaults.py,sha256=jdBx5SZ-m3Hy_J4EhFiyKkOtpZ_vvpevbl
|
|
18
19
|
faster_app/routes/builtins/swagger.py,sha256=tn26PfFYtPNN8hfgO26ayLG8rtW7ywiEK90BlE5iaQU,463
|
19
20
|
faster_app/settings/__init__.py,sha256=a9_8V1pjeLqdAq1H8GW73Ua_dZgTrE_SogN9yrKeB6s,174
|
20
21
|
faster_app/settings/discover.py,sha256=82MLZyeVXYn-U_bIJ9BVdJAVUoBILM9GbNCLHVAIxqc,2319
|
21
|
-
faster_app/settings/builtins/settings.py,sha256=
|
22
|
-
faster_app/statics/swagger-ui-bundle.min.js,sha256
|
22
|
+
faster_app/settings/builtins/settings.py,sha256=Det6QBPD3i8_bX8B1ctyDpwY_dFpSb5cpcmgQieFz2E,1701
|
23
|
+
faster_app/statics/swagger-ui-bundle.min.js,sha256=w6C-vNFi185FT5HmCdQWpp8FIN9dIxIF_I6P7a8dWYg,2980189
|
23
24
|
faster_app/statics/swagger-ui.min.css,sha256=v0okdo-JS6djtsQ2gZeXadMN1H4wWGUWzLx2qMcfs-s,150626
|
24
|
-
faster_app
|
25
|
-
faster_app
|
26
|
-
faster_app
|
27
|
-
faster_app
|
28
|
-
faster_app-0.0.
|
25
|
+
faster_app/templates/apps/demo/commands.py,sha256=KECFqPzxn46qpveRARoxyyYk_ZVZ-R-YSUIsd5y8QiA,445
|
26
|
+
faster_app/templates/apps/demo/models.py,sha256=RfodpzyDfhwbfxfRg_qMwTVFjV7n8uLfJTFsCaWUNHs,328
|
27
|
+
faster_app/templates/apps/demo/routes.py,sha256=Ye1IsU-xDox33IETZQ4K2LLIWkeby9whzVmQqB9JaFY,270
|
28
|
+
faster_app/templates/config/settings.py,sha256=N7fLT5qyZ550fzK1Ma-HU-tz4eDO-nSa1whHzoBTunU,182
|
29
|
+
faster_app-0.0.7.dist-info/licenses/LICENSE,sha256=VlZLv92YNpRecXnQ92BsEhMZK0zX453xnBFta4eGPRE,1073
|
30
|
+
faster_app-0.0.7.dist-info/METADATA,sha256=xANbpWglLSy374p0QM0Jzw-oZ18mjSS6PgY-9SZaQ6k,7382
|
31
|
+
faster_app-0.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
32
|
+
faster_app-0.0.7.dist-info/top_level.txt,sha256=Ah5KB3gcZwXCVsxO8kQtaC0Y7Uy__QFm1p_RJGo5UIU,11
|
33
|
+
faster_app-0.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|