faster-app 0.0.11__tar.gz → 0.0.12__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 (42) hide show
  1. {faster_app-0.0.11 → faster_app-0.0.12}/PKG-INFO +1 -1
  2. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/__init__.py +1 -1
  3. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/commands/base.py +1 -1
  4. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/commands/builtins/app.py +6 -15
  5. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/commands/builtins/db.py +1 -1
  6. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/commands/builtins/fastapi.py +3 -1
  7. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/commands/discover.py +13 -0
  8. faster_app-0.0.12/faster_app/main.py +18 -0
  9. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app.egg-info/PKG-INFO +1 -1
  10. {faster_app-0.0.11 → faster_app-0.0.12}/pyproject.toml +1 -1
  11. faster_app-0.0.11/faster_app/main.py +0 -27
  12. {faster_app-0.0.11 → faster_app-0.0.12}/LICENSE +0 -0
  13. {faster_app-0.0.11 → faster_app-0.0.12}/README.md +0 -0
  14. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/.env.example +0 -0
  15. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/base.py +0 -0
  16. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/commands/__init__.py +0 -0
  17. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/commands/builtins/__init__.py +0 -0
  18. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/db.py +0 -0
  19. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/models/__init__.py +0 -0
  20. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/models/base.py +0 -0
  21. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/models/discover.py +0 -0
  22. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/routes/__init__.py +0 -0
  23. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/routes/base.py +0 -0
  24. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/routes/builtins/__init__.py +0 -0
  25. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/routes/builtins/defaults.py +0 -0
  26. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/routes/builtins/swagger.py +0 -0
  27. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/routes/discover.py +0 -0
  28. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/settings/__init__.py +0 -0
  29. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/settings/builtins/settings.py +0 -0
  30. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/settings/discover.py +0 -0
  31. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/statics/swagger-ui-bundle.min.js +0 -0
  32. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/statics/swagger-ui.min.css +0 -0
  33. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/templates/apps/demo/commands.py +0 -0
  34. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/templates/apps/demo/models.py +0 -0
  35. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/templates/apps/demo/routes.py +0 -0
  36. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app/templates/config/settings.py +0 -0
  37. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app.egg-info/SOURCES.txt +0 -0
  38. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app.egg-info/dependency_links.txt +0 -0
  39. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app.egg-info/entry_points.txt +0 -0
  40. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app.egg-info/requires.txt +0 -0
  41. {faster_app-0.0.11 → faster_app-0.0.12}/faster_app.egg-info/top_level.txt +0 -0
  42. {faster_app-0.0.11 → faster_app-0.0.12}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: faster_app
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: 一个轻量级的 Python Web 框架,提供自动发现、模型基类、命令行工具等功能
5
5
  Author-email: peizhenfei <peizhenfei@hotmail.com>
6
6
  Maintainer-email: peizhenfei <peizhenfei@hotmail.com>
@@ -9,7 +9,7 @@ Faster APP - 一个轻量级的 Python Web 框架
9
9
  - 数据库连接管理 (tortoise_init)
10
10
  """
11
11
 
12
- __version__ = "0.0.11"
12
+ __version__ = "0.0.12"
13
13
  __author__ = "peizhenfei"
14
14
  __email__ = "peizhenfei@hotmail.com"
15
15
 
@@ -60,7 +60,7 @@ class CommandBase(object):
60
60
  return attr
61
61
 
62
62
  @classmethod
63
- def get_command_name(cls, class_name: str = None, suffixes: list = None) -> str:
63
+ def _get_command_name(cls, class_name: str = None, suffixes: list = None) -> str:
64
64
  """
65
65
  自动去除类名中的常见后缀,生成简洁的命令名
66
66
 
@@ -9,18 +9,14 @@ console = Console()
9
9
  class AppCommand(CommandBase):
10
10
  """App Command"""
11
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
-
12
+ async def env(self):
13
+ """Create .env file"""
18
14
  # 拷贝项目根路径下的 .env.example 文件到项目根路径
19
15
  shutil.copy(f"{self.BASE_PATH}/.env.example", ".env")
20
16
  console.print("✅ .env created successfully")
21
17
 
22
18
  async def demo(self):
23
- """Run Demo"""
19
+ """create demo app"""
24
20
  # 项目根路径下创建 apps 目录,如果存在则跳过
25
21
  if not os.path.exists("apps"):
26
22
  os.makedirs("apps")
@@ -28,11 +24,6 @@ class AppCommand(CommandBase):
28
24
  shutil.copytree(f"{self.BASE_PATH}/templates/apps/demo", "apps/demo")
29
25
 
30
26
  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
- )
27
+ """create config"""
28
+ # 拷贝 templates/config 到 . 目录
29
+ shutil.copytree(f"{self.BASE_PATH}/templates/config", ".")
@@ -13,7 +13,7 @@ console = Console()
13
13
 
14
14
 
15
15
  class DBOperations(CommandBase):
16
- """数据库操作命令 - 使用Aerich管理数据库迁移"""
16
+ """DB Operations - 使用 Aerich 管理数据库迁移"""
17
17
 
18
18
  def __init__(self, fake: bool = False):
19
19
  self.fake = fake
@@ -69,7 +69,9 @@ class FastAPIAppSingleton:
69
69
  app = FastAPIAppSingleton()
70
70
 
71
71
 
72
- class FastApiOperations(CommandBase):
72
+ class ServerOperations(CommandBase):
73
+ """FastAPI Server Operations"""
74
+
73
75
  def __init__(self, host: str = None, port: int = None):
74
76
  configs = DefaultSettings()
75
77
  self.host = host or configs.HOST
@@ -2,6 +2,7 @@
2
2
  自动发现 apps 目录下的 commands 模块和内置命令
3
3
  """
4
4
 
5
+ from typing import Dict
5
6
  from faster_app.commands.base import CommandBase
6
7
  from faster_app.base import DiscoverBase
7
8
 
@@ -22,3 +23,15 @@ class CommandDiscover(DiscoverBase):
22
23
  "skip_files": [],
23
24
  },
24
25
  ]
26
+
27
+ def collect(self) -> Dict[str, CommandBase]:
28
+ commands = {}
29
+ command_instances = self.discover()
30
+
31
+ # 将命令实例转换为字典,使用类名作为键
32
+ for instance in command_instances:
33
+ # 使用 CommandBase 的 _get_command_name 方法自动去除后缀
34
+ command_name = instance._get_command_name()
35
+ commands[command_name] = instance
36
+
37
+ return commands
@@ -0,0 +1,18 @@
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
+ commands = CommandDiscover().collect()
14
+ fire.Fire(commands)
15
+
16
+
17
+ if __name__ == "__main__":
18
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: faster_app
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: 一个轻量级的 Python Web 框架,提供自动发现、模型基类、命令行工具等功能
5
5
  Author-email: peizhenfei <peizhenfei@hotmail.com>
6
6
  Maintainer-email: peizhenfei <peizhenfei@hotmail.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "faster_app"
7
- version = "0.0.11"
7
+ version = "0.0.12"
8
8
  description = "一个轻量级的 Python Web 框架,提供自动发现、模型基类、命令行工具等功能"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,27 +0,0 @@
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()
File without changes
File without changes
File without changes