faster-app 0.0.6__py3-none-any.whl → 0.0.8__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 CHANGED
@@ -9,7 +9,7 @@ Faster APP - 一个轻量级的 Python Web 框架
9
9
  - 数据库连接管理 (tortoise_init)
10
10
  """
11
11
 
12
- __version__ = "0.0.6"
12
+ __version__ = "0.0.8"
13
13
  __author__ = "peizhenfei"
14
14
  __email__ = "peizhenfei@hotmail.com"
15
15
 
@@ -1,11 +1,24 @@
1
1
  import os
2
2
  import shutil
3
3
  from faster_app.commands.base import CommandBase
4
+ from rich.console import Console
5
+
6
+ console = Console()
4
7
 
5
8
 
6
9
  class AppCommand(CommandBase):
7
10
  """App Command"""
8
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
+
9
22
  async def demo(self):
10
23
  """Run Demo"""
11
24
  # 项目根路径下创建 apps 目录,如果存在则跳过
@@ -23,8 +36,3 @@ class AppCommand(CommandBase):
23
36
  shutil.copytree(
24
37
  f"{self.BASE_PATH}/templates/config/settings.py", "config/settings.py"
25
38
  )
26
-
27
- async def env(self):
28
- """create .env file"""
29
- # 拷贝项目根路径下的 .env.example 文件到项目根路径
30
- shutil.copy(f"{self.BASE_PATH}/.env.example", ".env")
@@ -11,7 +11,7 @@ class DefaultSettings(BaseSettings):
11
11
 
12
12
  # 基础配置
13
13
  PROJECT_NAME: str = "Faster APP"
14
- VERSION: str = "0.0.6"
14
+ VERSION: str = "0.0.8"
15
15
  DEBUG: bool = True
16
16
 
17
17
  # Server 配置
@@ -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.6") ||
31829
+ 0 <= r()(e).call(e, "127.0.0.8") ||
31830
31830
  "none" === e
31831
31831
  );
31832
31832
  },
@@ -5,5 +5,5 @@ class Settings(BaseSettings):
5
5
  """Settings"""
6
6
 
7
7
  PROJECT_NAME: str = "Faster APP"
8
- VERSION: str = "0.0.6"
8
+ VERSION: str = "0.0.8"
9
9
  DEBUG: bool = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: faster_app
3
- Version: 0.0.6
3
+ Version: 0.0.8
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.6"
204
+ HOST: str = "127.0.0.8"
205
205
  PORT: int = 8000
206
206
 
207
207
  # API 配置
@@ -1,11 +1,12 @@
1
- faster_app/__init__.py,sha256=fLdguFL1b5cherqKQPoN7c4CsCNIwERIhDyJ5s3WkyI,1425
1
+ main.py,sha256=En5hYXB-wbcnEFmQ6mmMlwnO1y-SM5nFcLsMN9dZk4s,613
2
+ faster_app/__init__.py,sha256=tsVa0Dxr-cJfLBjHedkKm2zRIgFo5-lGlhizcYi9P-o,1425
2
3
  faster_app/base.py,sha256=8350gBg_GkW_ww_lDvIOODFOJ71_yowQ5gd_tMTPrQ8,4035
3
4
  faster_app/db.py,sha256=uG4k_eSy5C2MP7DF-senxI10sLAGrLkgmBRFfH_91kY,994
4
5
  faster_app/commands/__init__.py,sha256=AgjI6NmKpdzNTH93XvXsvh54F7PiRX-MJq6emITw7K4,258
5
6
  faster_app/commands/base.py,sha256=c5wRPxIBEyJLgBTrFGGDUs4Xh4h9gMxFHlNOf6MgcMo,2544
6
7
  faster_app/commands/discover.py,sha256=7pWETGJmRi6KDj-LcBLbmusKIvPElGFU6T92WvdRTew,620
7
8
  faster_app/commands/builtins/__init__.py,sha256=Wi3YfjUhZ45VNh7SoLdtCATjAPbWjSwv0gpmFZGJMHA,27
8
- faster_app/commands/builtins/app.py,sha256=UHzE6XOPsxw0w5bqmXyv5kAuJOgDaGp9fo3zRQTFbIQ,1036
9
+ faster_app/commands/builtins/app.py,sha256=LIcFuk4Xy19dhNn2DpFS6Zd5tjmLCBszprpI9iUjTI0,1332
9
10
  faster_app/commands/builtins/db.py,sha256=cGxa98VC-h1Wl725GUvcu1XYAtAwY6n3t_0pNa-fbho,4741
10
11
  faster_app/commands/builtins/fastapi.py,sha256=QOdnt63V0PHRgjZvVLeZXbE94YaOc5uN39e4SmwPtwY,2392
11
12
  faster_app/models/__init__.py,sha256=6Mn6zjxF0JJfhDik4LNaXDNLxGgdgl5ECBbqLvgkpxs,334
@@ -19,15 +20,16 @@ faster_app/routes/builtins/defaults.py,sha256=jdBx5SZ-m3Hy_J4EhFiyKkOtpZ_vvpevbl
19
20
  faster_app/routes/builtins/swagger.py,sha256=tn26PfFYtPNN8hfgO26ayLG8rtW7ywiEK90BlE5iaQU,463
20
21
  faster_app/settings/__init__.py,sha256=a9_8V1pjeLqdAq1H8GW73Ua_dZgTrE_SogN9yrKeB6s,174
21
22
  faster_app/settings/discover.py,sha256=82MLZyeVXYn-U_bIJ9BVdJAVUoBILM9GbNCLHVAIxqc,2319
22
- faster_app/settings/builtins/settings.py,sha256=i4AHEETao6UmoU80dekowpufc5x32vGAgtmZcOhYkAU,1701
23
- faster_app/statics/swagger-ui-bundle.min.js,sha256=ovswPP3pQf5xoxSr3CM9Lh0-x3loRobriz6lyS7B31A,2980189
23
+ faster_app/settings/builtins/settings.py,sha256=OHZuwF-3skk8zBXL4hxqVQtWhae3DlI-NlStlUZHgUg,1701
24
+ faster_app/statics/swagger-ui-bundle.min.js,sha256=hhbrS_TL67s5ajKaFxHsIOEVUNkg5iIZEJ0sNJV9iX4,2980189
24
25
  faster_app/statics/swagger-ui.min.css,sha256=v0okdo-JS6djtsQ2gZeXadMN1H4wWGUWzLx2qMcfs-s,150626
25
26
  faster_app/templates/apps/demo/commands.py,sha256=KECFqPzxn46qpveRARoxyyYk_ZVZ-R-YSUIsd5y8QiA,445
26
27
  faster_app/templates/apps/demo/models.py,sha256=RfodpzyDfhwbfxfRg_qMwTVFjV7n8uLfJTFsCaWUNHs,328
27
28
  faster_app/templates/apps/demo/routes.py,sha256=Ye1IsU-xDox33IETZQ4K2LLIWkeby9whzVmQqB9JaFY,270
28
- faster_app/templates/config/settings.py,sha256=Pfwq6FJjDq7sqTffP-FhJMAF1aE3NtyffMHiGJXUMVM,182
29
- faster_app-0.0.6.dist-info/licenses/LICENSE,sha256=VlZLv92YNpRecXnQ92BsEhMZK0zX453xnBFta4eGPRE,1073
30
- faster_app-0.0.6.dist-info/METADATA,sha256=GBfvspAzlFIXjoQPh7j9Xx3KmJCKQ-xKt0lWj_PlTnM,7382
31
- faster_app-0.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
- faster_app-0.0.6.dist-info/top_level.txt,sha256=Ah5KB3gcZwXCVsxO8kQtaC0Y7Uy__QFm1p_RJGo5UIU,11
33
- faster_app-0.0.6.dist-info/RECORD,,
29
+ faster_app/templates/config/settings.py,sha256=GWPTj0Uo169NppdbDcHjNIx4uxd0EeES_ssbZt1E-XY,182
30
+ faster_app-0.0.8.dist-info/licenses/LICENSE,sha256=VlZLv92YNpRecXnQ92BsEhMZK0zX453xnBFta4eGPRE,1073
31
+ faster_app-0.0.8.dist-info/METADATA,sha256=woTLQ9dLz9rf51LwpVRKAwN7030hItLldTUHrOafgdo,7382
32
+ faster_app-0.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ faster_app-0.0.8.dist-info/entry_points.txt,sha256=sWqd_BtqZPR1ET8qzd39omJRLh_cW7tHBNUTWSkI2JQ,41
34
+ faster_app-0.0.8.dist-info/top_level.txt,sha256=j75Oo5nWjUaghO8XErOuYDFW9BfKvZub9b2fnjECvAg,16
35
+ faster_app-0.0.8.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ faster-app = main:main
main.py ADDED
@@ -0,0 +1,27 @@
1
+ """
2
+ Faster APP 命令行入口
3
+ """
4
+
5
+ import fire
6
+ from faster_app.commands.discover import CommandDiscover
7
+
8
+
9
+ def main():
10
+ """
11
+ Faster APP 命令行入口点
12
+ """
13
+ command_instances = CommandDiscover().discover()
14
+
15
+ # 将命令实例转换为字典,使用类名作为键
16
+ commands = {}
17
+ for instance in command_instances:
18
+ # 使用 CommandBase 的 get_command_name 方法自动去除后缀
19
+ command_name = instance.get_command_name()
20
+ commands[command_name] = instance
21
+
22
+ # 直接传递命令字典给 Fire
23
+ fire.Fire(commands)
24
+
25
+
26
+ if __name__ == "__main__":
27
+ main()