FastAPI-fastkit 1.0.0__py3-none-any.whl → 1.0.2__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.
Files changed (128) hide show
  1. fastapi_fastkit/__init__.py +10 -1
  2. fastapi_fastkit/backend/main.py +482 -482
  3. fastapi_fastkit/backend/transducer.py +106 -106
  4. fastapi_fastkit/cli.py +664 -631
  5. fastapi_fastkit/core/settings.py +155 -155
  6. fastapi_fastkit/fastapi_project_template/README.md +90 -90
  7. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/.env-tpl +1 -1
  8. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/.gitignore-tpl +30 -30
  9. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/README.md-tpl +107 -107
  10. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/requirements.txt-tpl +36 -36
  11. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/format.sh-tpl +5 -5
  12. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/lint.sh-tpl +5 -5
  13. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/run-server.sh-tpl +8 -8
  14. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/test.sh-tpl +6 -6
  15. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/setup.cfg-tpl +14 -14
  16. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/setup.py-tpl +25 -25
  17. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/api/api.py-tpl +9 -9
  18. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/api/routes/items.py-tpl +57 -57
  19. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/core/config.py-tpl +64 -64
  20. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/crud/items.py-tpl +21 -21
  21. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/main.py-tpl +26 -26
  22. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/mocks/mock_items.json-tpl +8 -8
  23. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/schemas/items.py-tpl +22 -22
  24. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/tests/conftest.py-tpl +42 -42
  25. fastapi_fastkit/fastapi_project_template/fastapi-async-crud/tests/test_items.py-tpl +48 -48
  26. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/.env-tpl +1 -1
  27. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/.gitignore-tpl +191 -191
  28. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/README.md-tpl +156 -156
  29. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/requirements.txt-tpl +36 -36
  30. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/format.sh-tpl +5 -5
  31. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/lint.sh-tpl +5 -5
  32. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/run-server.sh-tpl +8 -8
  33. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/test.sh-tpl +6 -6
  34. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/setup.cfg-tpl +12 -12
  35. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/setup.py-tpl +27 -27
  36. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/.DS_Store +0 -0
  37. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/api/api.py-tpl +9 -9
  38. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/api/routes/items.py-tpl +172 -172
  39. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/core/config.py-tpl +64 -64
  40. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/crud/items.py-tpl +21 -21
  41. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/helper/exceptions.py-tpl +103 -103
  42. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/helper/pagination.py-tpl +72 -72
  43. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/main.py-tpl +39 -39
  44. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/mocks/mock_items.json-tpl +8 -8
  45. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/schemas/base.py-tpl +49 -49
  46. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/schemas/items.py-tpl +22 -22
  47. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/utils/documents.py-tpl +20 -20
  48. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/tests/conftest.py-tpl +42 -42
  49. fastapi_fastkit/fastapi_project_template/fastapi-custom-response/tests/test_items.py-tpl +61 -61
  50. fastapi_fastkit/fastapi_project_template/fastapi-default/README.md-tpl +101 -101
  51. fastapi_fastkit/fastapi_project_template/fastapi-default/scripts/run-server.sh-tpl +8 -8
  52. fastapi_fastkit/fastapi_project_template/fastapi-default/setup.py-tpl +22 -22
  53. fastapi_fastkit/fastapi_project_template/fastapi-default/src/mocks/mock_items.json-tpl +8 -8
  54. fastapi_fastkit/fastapi_project_template/fastapi-default/tests/conftest.py-tpl +30 -30
  55. fastapi_fastkit/fastapi_project_template/fastapi-default/tests/test_items.py-tpl +44 -44
  56. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/.env-tpl +1 -1
  57. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/.gitignore-tpl +30 -30
  58. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/Dockerfile-tpl +23 -23
  59. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/README.md-tpl +119 -119
  60. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/requirements.txt-tpl +36 -36
  61. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/format.sh-tpl +5 -5
  62. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/lint.sh-tpl +5 -5
  63. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/run-server.sh-tpl +8 -8
  64. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/test.sh-tpl +6 -6
  65. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/setup.cfg-tpl +13 -13
  66. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/setup.py-tpl +22 -22
  67. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/api/api.py-tpl +6 -6
  68. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/api/routes/items.py-tpl +54 -54
  69. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/core/config.py-tpl +64 -64
  70. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/crud/items.py-tpl +15 -15
  71. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/main.py-tpl +26 -26
  72. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/mocks/mock_items.json-tpl +8 -8
  73. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/schemas/items.py-tpl +19 -19
  74. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/tests/conftest.py-tpl +30 -30
  75. fastapi_fastkit/fastapi_project_template/fastapi-dockerized/tests/test_items.py-tpl +44 -44
  76. fastapi_fastkit/fastapi_project_template/fastapi-empty/.env-tpl +1 -1
  77. fastapi_fastkit/fastapi_project_template/fastapi-empty/setup.py-tpl +22 -22
  78. fastapi_fastkit/fastapi_project_template/fastapi-empty/src/core/config.py-tpl +75 -75
  79. fastapi_fastkit/fastapi_project_template/fastapi-empty/src/main.py-tpl +36 -36
  80. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/.env-tpl +9 -9
  81. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/.gitignore-tpl +30 -30
  82. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/Dockerfile-tpl +23 -23
  83. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/README.md-tpl +144 -144
  84. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/alembic.ini-tpl +119 -119
  85. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/docker-compose.yml-tpl +44 -44
  86. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/requirements.txt-tpl +41 -41
  87. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/format.sh-tpl +5 -5
  88. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/lint.sh-tpl +5 -5
  89. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/pre-start.sh-tpl +16 -16
  90. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/run-server.sh-tpl +8 -8
  91. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/test.sh-tpl +10 -10
  92. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/setup.cfg-tpl +13 -13
  93. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/setup.py-tpl +25 -25
  94. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/README-tpl +1 -1
  95. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/env.py-tpl +85 -85
  96. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/script.py.mako-tpl +26 -26
  97. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/versions/bedcdc35b64a_first_alembic.py-tpl +37 -37
  98. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/api.py-tpl +11 -11
  99. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/deps.py-tpl +19 -19
  100. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/routes/items.py-tpl +109 -109
  101. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/core/config.py-tpl +88 -88
  102. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/core/db.py-tpl +53 -53
  103. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/crud/items.py-tpl +102 -102
  104. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/main.py-tpl +45 -45
  105. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/schemas/items.py-tpl +54 -54
  106. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/backend_pre_start.py-tpl +39 -39
  107. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/init_data.py-tpl +23 -23
  108. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/tests_pre_start.py-tpl +39 -39
  109. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/tests/conftest.py-tpl +63 -63
  110. fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/tests/test_items.py-tpl +44 -44
  111. fastapi_fastkit/fastapi_project_template/modules/api/routes/new_route.py-tpl +64 -64
  112. fastapi_fastkit/fastapi_project_template/modules/crud/new_route.py-tpl +29 -29
  113. fastapi_fastkit/fastapi_project_template/modules/schemas/new_route.py-tpl +23 -23
  114. fastapi_fastkit/logs/fastkit_debug_20250702_161423.log +21 -0
  115. fastapi_fastkit/logs/fastkit_debug_20250702_162706.log +20 -0
  116. fastapi_fastkit/logs/fastkit_debug_20250702_163010.log +21 -0
  117. fastapi_fastkit/logs/fastkit_debug_20250702_163526.log +21 -0
  118. fastapi_fastkit/logs/fastkit_debug_20250702_164053.log +21 -0
  119. fastapi_fastkit/logs/fastkit_debug_20250702_165220.log +21 -0
  120. fastapi_fastkit/logs/fastkit_debug_20250702_165647.log +21 -0
  121. fastapi_fastkit/utils/logging.py +112 -1
  122. fastapi_fastkit/utils/main.py +140 -129
  123. fastapi_fastkit-1.0.2.dist-info/METADATA +320 -0
  124. {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/RECORD +127 -119
  125. {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/WHEEL +1 -1
  126. {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/licenses/LICENSE +21 -21
  127. fastapi_fastkit-1.0.0.dist-info/METADATA +0 -208
  128. {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/entry_points.txt +0 -0
@@ -1,129 +1,140 @@
1
- # --------------------------------------------------------------------------
2
- # The Module defines utility functions for FastAPI-fastkit CLI.
3
- #
4
- # @author bnbong bbbong9@gmail.com
5
- # --------------------------------------------------------------------------
6
- import os
7
- import re
8
- import traceback
9
- from typing import Any, Optional
10
-
11
- import click
12
- from click.core import Context
13
- from rich.console import Console
14
- from rich.panel import Panel
15
- from rich.table import Table
16
- from rich.text import Text
17
-
18
- from fastapi_fastkit import console
19
- from fastapi_fastkit.core.settings import settings
20
-
21
- REGEX = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b"
22
-
23
-
24
- def print_error(
25
- message: str,
26
- title: str = "Error",
27
- console: Console = console,
28
- show_traceback: bool = False,
29
- ) -> None:
30
- """Print an error message with specified output style."""
31
- error_text = Text()
32
- error_text.append("❌ ", style="bold red")
33
- error_text.append(message)
34
- console.print(Panel(error_text, border_style="red", title=title))
35
-
36
- if show_traceback and settings.DEBUG_MODE:
37
- console.print("[bold yellow]Stack trace:[/bold yellow]")
38
- console.print(traceback.format_exc())
39
-
40
-
41
- def handle_exception(e: Exception, message: Optional[str] = None) -> None:
42
- """
43
- Handle exception and print appropriate error message.
44
-
45
- :param e: The exception that occurred
46
- :param message: Optional custom error message
47
- """
48
- error_msg = message or f"Error: {str(e)}"
49
-
50
- # Show traceback if in debug mode
51
- print_error(error_msg, show_traceback=True)
52
-
53
-
54
- def print_success(
55
- message: str, title: str = "Success", console: Console = console
56
- ) -> None:
57
- """Print a success message with specified output style."""
58
- success_text = Text()
59
- success_text.append("✨ ", style="bold yellow")
60
- success_text.append(message, style="bold green")
61
- console.print(Panel(success_text, border_style="green", title=title))
62
-
63
-
64
- def print_warning(
65
- message: str, title: str = "Warning", console: Console = console
66
- ) -> None:
67
- """Print a warning message with specified output style."""
68
- warning_text = Text()
69
- warning_text.append("⚠️ ", style="bold yellow")
70
- warning_text.append(message)
71
- console.print(Panel(warning_text, border_style="yellow", title=title))
72
-
73
-
74
- def print_info(message: str, title: str = "Info", console: Console = console) -> None:
75
- """Print an info message with specified output style."""
76
- info_text = Text()
77
- info_text.append("ℹ ", style="bold blue")
78
- info_text.append(message)
79
- console.print(Panel(info_text, border_style="blue", title=title))
80
-
81
-
82
- def create_info_table(
83
- title: str,
84
- data: Optional[dict[str, str]] = None,
85
- show_header: bool = False,
86
- console: Console = console,
87
- ) -> Table:
88
- """Create a table for displaying information."""
89
- table = Table(title=title, show_header=show_header, title_style="bold magenta")
90
- table.add_column("Field", style="cyan")
91
- table.add_column("Value", style="green")
92
-
93
- if data:
94
- for key, value in data.items():
95
- table.add_row(key, value)
96
-
97
- return table
98
-
99
-
100
- def validate_email(ctx: Context, param: Any, value: Any) -> Any:
101
- """Validate email format."""
102
- try:
103
- if not re.match(REGEX, value):
104
- raise ValueError(value)
105
- return value
106
- except ValueError as e:
107
- print_error(f"Incorrect email address given: {e}")
108
- value = click.prompt(param.prompt)
109
- return validate_email(ctx, param, value)
110
-
111
-
112
- def is_fastkit_project(project_dir: str) -> bool:
113
- """
114
- Check if the project was created with fastkit.
115
- Inspects the contents of the setup.py file.
116
-
117
- :param project_dir: Project directory
118
- :return: True if the project was created with fastkit, False otherwise
119
- """
120
- setup_py = os.path.join(project_dir, "setup.py")
121
- if not os.path.exists(setup_py):
122
- return False
123
-
124
- try:
125
- with open(setup_py, "r") as f:
126
- content = f.read()
127
- return "FastAPI-fastkit" in content
128
- except:
129
- return False
1
+ # --------------------------------------------------------------------------
2
+ # The Module defines utility functions for FastAPI-fastkit CLI.
3
+ #
4
+ # @author bnbong bbbong9@gmail.com
5
+ # --------------------------------------------------------------------------
6
+ import os
7
+ import re
8
+ import traceback
9
+ from typing import Any, Optional
10
+
11
+ import click
12
+ from click.core import Context
13
+ from rich.console import Console
14
+ from rich.panel import Panel
15
+ from rich.table import Table
16
+ from rich.text import Text
17
+
18
+ from fastapi_fastkit import console
19
+ from fastapi_fastkit.core.settings import settings
20
+ from fastapi_fastkit.utils.logging import get_logger
21
+
22
+ REGEX = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b"
23
+
24
+
25
+ def print_error(
26
+ message: str,
27
+ title: str = "Error",
28
+ console: Console = console,
29
+ show_traceback: bool = False,
30
+ ) -> None:
31
+ """Print an error message with specified output style."""
32
+ error_text = Text()
33
+ error_text.append("❌ ", style="bold red")
34
+ error_text.append(message)
35
+ console.print(Panel(error_text, border_style="red", title=title))
36
+
37
+ # Log error if debug mode is enabled
38
+ if settings.DEBUG_MODE:
39
+ logger = get_logger()
40
+ logger.error(f"Error: {message}")
41
+
42
+ if show_traceback and settings.DEBUG_MODE:
43
+ console.print("[bold yellow]Stack trace:[/bold yellow]")
44
+ console.print(traceback.format_exc())
45
+
46
+
47
+ def handle_exception(e: Exception, message: Optional[str] = None) -> None:
48
+ """
49
+ Handle exception and print appropriate error message.
50
+
51
+ :param e: The exception that occurred
52
+ :param message: Optional custom error message
53
+ """
54
+ error_msg = message or f"Error: {str(e)}"
55
+
56
+ # Log exception if debug mode is enabled
57
+ if settings.DEBUG_MODE:
58
+ logger = get_logger()
59
+ logger.exception(f"Exception occurred: {error_msg}", exc_info=e)
60
+
61
+ # Show traceback if in debug mode
62
+ print_error(error_msg, show_traceback=True)
63
+
64
+
65
+ def print_success(
66
+ message: str, title: str = "Success", console: Console = console
67
+ ) -> None:
68
+ """Print a success message with specified output style."""
69
+ success_text = Text()
70
+ success_text.append("✨ ", style="bold yellow")
71
+ success_text.append(message, style="bold green")
72
+ console.print(Panel(success_text, border_style="green", title=title))
73
+
74
+
75
+ def print_warning(
76
+ message: str, title: str = "Warning", console: Console = console
77
+ ) -> None:
78
+ """Print a warning message with specified output style."""
79
+ warning_text = Text()
80
+ warning_text.append("⚠️ ", style="bold yellow")
81
+ warning_text.append(message)
82
+ console.print(Panel(warning_text, border_style="yellow", title=title))
83
+
84
+
85
+ def print_info(message: str, title: str = "Info", console: Console = console) -> None:
86
+ """Print an info message with specified output style."""
87
+ info_text = Text()
88
+ info_text.append("ℹ ", style="bold blue")
89
+ info_text.append(message)
90
+ console.print(Panel(info_text, border_style="blue", title=title))
91
+
92
+
93
+ def create_info_table(
94
+ title: str,
95
+ data: Optional[dict[str, str]] = None,
96
+ show_header: bool = False,
97
+ console: Console = console,
98
+ ) -> Table:
99
+ """Create a table for displaying information."""
100
+ table = Table(title=title, show_header=show_header, title_style="bold magenta")
101
+ table.add_column("Field", style="cyan")
102
+ table.add_column("Value", style="green")
103
+
104
+ if data:
105
+ for key, value in data.items():
106
+ table.add_row(key, value)
107
+
108
+ return table
109
+
110
+
111
+ def validate_email(ctx: Context, param: Any, value: Any) -> Any:
112
+ """Validate email format."""
113
+ try:
114
+ if not re.match(REGEX, value):
115
+ raise ValueError(value)
116
+ return value
117
+ except ValueError as e:
118
+ print_error(f"Incorrect email address given: {e}")
119
+ value = click.prompt(param.prompt)
120
+ return validate_email(ctx, param, value)
121
+
122
+
123
+ def is_fastkit_project(project_dir: str) -> bool:
124
+ """
125
+ Check if the project was created with fastkit.
126
+ Inspects the contents of the setup.py file.
127
+
128
+ :param project_dir: Project directory
129
+ :return: True if the project was created with fastkit, False otherwise
130
+ """
131
+ setup_py = os.path.join(project_dir, "setup.py")
132
+ if not os.path.exists(setup_py):
133
+ return False
134
+
135
+ try:
136
+ with open(setup_py, "r") as f:
137
+ content = f.read()
138
+ return "FastAPI-fastkit" in content
139
+ except:
140
+ return False
@@ -0,0 +1,320 @@
1
+ Metadata-Version: 2.1
2
+ Name: FastAPI-fastkit
3
+ Version: 1.0.2
4
+ Summary: Fast, easy-to-use starter kit for new users of Python and FastAPI
5
+ Author-Email: bnbong <bbbong9@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/bnbong/FastAPI-kit
8
+ Project-URL: Repository, https://github.com/bnbong/FastAPI-kit
9
+ Project-URL: Documentation, https://bnbong.github.io/FastAPI-fastkit/
10
+ Project-URL: Changelog, https://bnbong.github.io/FastAPI-fastkit/changelog/
11
+ Requires-Python: >=3.12
12
+ Requires-Dist: click>=8.1.7
13
+ Requires-Dist: rich>=13.9.2
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=8.3.3; extra == "dev"
16
+ Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
17
+ Requires-Dist: black>=24.10.0; extra == "dev"
18
+ Requires-Dist: pre-commit>=4.0.1; extra == "dev"
19
+ Requires-Dist: mypy>=1.12.0; extra == "dev"
20
+ Requires-Dist: isort>=5.13.2; extra == "dev"
21
+ Description-Content-Type: text/markdown
22
+
23
+ <p align="center">
24
+ <img align="top" width="70%" src="https://bnbong.github.io/projects/img/fastkit_general_logo.png" alt="FastAPI-fastkit"/>
25
+ </p>
26
+ <p align="center">
27
+ <em><b>FastAPI-fastkit</b>: Fast, easy-to-use starter kit for new users of Python and FastAPI</em>
28
+ </p>
29
+ <p align="center">
30
+ <a href="https://pypi.org/project/fastapi-fastkit" target="_blank">
31
+ <img src="https://img.shields.io/pypi/v/fastapi-fastkit" alt="PyPI - Version">
32
+ </a>
33
+ <a href="https://github.com/bnbong/FastAPI-fastkit/releases" target="_blank">
34
+ <img src="https://img.shields.io/github/v/release/bnbong/FastAPI-fastkit" alt="GitHub Release">
35
+ </a>
36
+ </p>
37
+
38
+ ---
39
+
40
+ This project was created to speed up the configuration of the development environment needed to develop Python-based web apps for new users of Python and [FastAPI](https://github.com/fastapi/fastapi).
41
+
42
+ This project was inspired by the `SpringBoot initializer` & Python Django's `django-admin` cli operation.
43
+
44
+ ## Key Features
45
+
46
+ - **Immediate FastAPI project creation** : Super-fast FastAPI workspace & project creation via CLI, inspired by `django-admin`feature of [Python Django](https://github.com/django/django)
47
+ - **Prettier CLI outputs** : beautiful CLI experiment ([rich library](https://github.com/Textualize/rich) feature)
48
+ - **Standards-based FastAPI project template** : All FastAPI-fastkit templates are based on Python standards and FastAPI's common use
49
+
50
+ ## Installation
51
+
52
+ Install `FastAPI-fastkit` at your Python environment.
53
+
54
+ ```console
55
+ $ pip install FastAPI-fastkit
56
+ ---> 100%
57
+ ```
58
+
59
+
60
+ ## Usage
61
+
62
+ ### Create a new FastAPI project workspace environment immediately
63
+
64
+ You can now start new FastAPI project really fast with FastAPI-fastkit!
65
+
66
+ Create a new FastAPI project workspace immediately with:
67
+
68
+ ```console
69
+ $ fastkit init
70
+ Enter the project name: my-awesome-project
71
+ Enter the author name: John Doe
72
+ Enter the author email: john@example.com
73
+ Enter the project description: My awesome FastAPI project
74
+
75
+ Project Information
76
+ ┌──────────────┬────────────────────────────┐
77
+ │ Project Name │ my-awesome-project │
78
+ │ Author │ John Doe │
79
+ │ Author Email │ john@example.com │
80
+ │ Description │ My awesome FastAPI project │
81
+ └──────────────┴────────────────────────────┘
82
+
83
+ Available Stacks and Dependencies:
84
+ MINIMAL Stack
85
+ ┌──────────────┬───────────────────┐
86
+ │ Dependency 1 │ fastapi │
87
+ │ Dependency 2 │ uvicorn │
88
+ │ Dependency 3 │ pydantic │
89
+ │ Dependency 4 │ pydantic-settings │
90
+ └──────────────┴───────────────────┘
91
+
92
+ STANDARD Stack
93
+ ┌──────────────┬───────────────────┐
94
+ │ Dependency 1 │ fastapi │
95
+ │ Dependency 2 │ uvicorn │
96
+ │ Dependency 3 │ sqlalchemy │
97
+ │ Dependency 4 │ alembic │
98
+ │ Dependency 5 │ pytest │
99
+ │ Dependency 6 │ pydantic │
100
+ │ Dependency 7 │ pydantic-settings │
101
+ └──────────────┴───────────────────┘
102
+
103
+ FULL Stack
104
+ ┌──────────────┬───────────────────┐
105
+ │ Dependency 1 │ fastapi │
106
+ │ Dependency 2 │ uvicorn │
107
+ │ Dependency 3 │ sqlalchemy │
108
+ │ Dependency 4 │ alembic │
109
+ │ Dependency 5 │ pytest │
110
+ │ Dependency 6 │ redis │
111
+ │ Dependency 7 │ celery │
112
+ │ Dependency 8 │ pydantic │
113
+ │ Dependency 9 │ pydantic-settings │
114
+ └──────────────┴───────────────────┘
115
+
116
+ Select stack (minimal, standard, full): minimal
117
+ Do you want to proceed with project creation? [y/N]: y
118
+ FastAPI project will deploy at '~your-project-path~'
119
+
120
+ ╭──────────────────────── Info ────────────────────────╮
121
+ │ ℹ Injected metadata into setup.py │
122
+ ╰──────────────────────────────────────────────────────╯
123
+ ╭──────────────────────── Info ────────────────────────╮
124
+ │ ℹ Injected metadata into config file │
125
+ ╰──────────────────────────────────────────────────────╯
126
+
127
+ Creating Project:
128
+ my-awesome-project
129
+ ┌───────────────────┬───────────┐
130
+ │ Component │ Collected │
131
+ │ fastapi │ ✓ │
132
+ │ uvicorn │ ✓ │
133
+ │ pydantic │ ✓ │
134
+ │ pydantic-settings │ ✓ │
135
+ └───────────────────┴───────────┘
136
+
137
+ Creating virtual environment...
138
+
139
+ ╭──────────────────────── Info ────────────────────────╮
140
+ │ ℹ venv created at │
141
+ │ ~your-project-path~/my-awesome-project/.venv │
142
+ │ To activate the virtual environment, run: │
143
+ │ │
144
+ │ source │
145
+ │ ~your-project-path~/my-awesome-project/.venv/bin/act │
146
+ │ ivate │
147
+ ╰──────────────────────────────────────────────────────╯
148
+
149
+ Installing dependencies...
150
+ ⠙ Setting up project environment...Collecting <packages~>
151
+
152
+ ---> 100%
153
+
154
+ ╭─────────────────────── Success ───────────────────────╮
155
+ │ ✨ Dependencies installed successfully │
156
+ ╰───────────────────────────────────────────────────────╯
157
+ ╭─────────────────────── Success ───────────────────────╮
158
+ │ ✨ FastAPI project 'my-awesome-project' has been │
159
+ │ created successfully and saved to │
160
+ │ ~your-project-path~! │
161
+ ╰───────────────────────────────────────────────────────╯
162
+ ╭──────────────────────── Info ────────────────────────╮
163
+ │ ℹ To start your project, run 'fastkit runserver' at │
164
+ │ newly created FastAPI project directory │
165
+ ╰──────────────────────────────────────────────────────╯
166
+ ```
167
+
168
+ This command will create a new FastAPI project workspace environment with Python virtual environment.
169
+
170
+ ### Add a new route to the FastAPI project
171
+
172
+ `FastAPI-fastkit` makes it easy to expand your FastAPI project.
173
+
174
+ Add a new route endpoint to your FastAPI project with:
175
+
176
+ ```console
177
+ $ fastkit addroute my-awesome-project user
178
+ Adding New Route
179
+ ┌──────────────────┬──────────────────────────────────────────┐
180
+ │ Project │ my-awesome-project │
181
+ │ Route Name │ user │
182
+ │ Target Directory │ ~your-project-path~ │
183
+ └──────────────────┴──────────────────────────────────────────┘
184
+
185
+ Do you want to add route 'user' to project 'my-awesome-project'? [Y/n]: y
186
+
187
+ ╭──────────────────────── Info ────────────────────────╮
188
+ │ ℹ Updated main.py to include the API router │
189
+ ╰──────────────────────────────────────────────────────╯
190
+ ╭─────────────────────── Success ───────────────────────╮
191
+ │ ✨ Successfully added new route 'user' to project │
192
+ │ `my-awesome-project` │
193
+ ╰───────────────────────────────────────────────────────╯
194
+ ```
195
+
196
+ ### Place a structured FastAPI demo project immediately
197
+
198
+ You can also start with a structured FastAPI demo project.
199
+
200
+ Demo projects are consist of various tech stacks with simple item CRUD endpoints implemented.
201
+
202
+ Place a structured FastAPI demo project immediately with:
203
+
204
+ ```console
205
+ $ fastkit startdemo
206
+ Enter the project name: my-awesome-demo
207
+ Enter the author name: John Doe
208
+ Enter the author email: john@example.com
209
+ Enter the project description: My awesome FastAPI demo
210
+ Deploying FastAPI project using 'fastapi-default' template
211
+ Template path:
212
+ /~fastapi_fastkit-package-path~/fastapi_project_template/fastapi-default
213
+
214
+ Project Information
215
+ ┌──────────────┬─────────────────────────┐
216
+ │ Project Name │ my-awesome-demo │
217
+ │ Author │ John Doe │
218
+ │ Author Email │ john@example.com │
219
+ │ Description │ My awesome FastAPI demo │
220
+ └──────────────┴─────────────────────────┘
221
+
222
+ Template Dependencies
223
+ ┌──────────────┬───────────────────┐
224
+ │ Dependency 1 │ fastapi │
225
+ │ Dependency 2 │ uvicorn │
226
+ │ Dependency 3 │ pydantic │
227
+ │ Dependency 4 │ pydantic-settings │
228
+ │ Dependency 5 │ python-dotenv │
229
+ └──────────────┴───────────────────┘
230
+
231
+ Do you want to proceed with project creation? [y/N]: y
232
+ FastAPI template project will deploy at '~your-project-path~'
233
+
234
+ ---> 100%
235
+
236
+ ╭─────────────────────── Success ───────────────────────╮
237
+ │ ✨ Dependencies installed successfully │
238
+ ╰───────────────────────────────────────────────────────╯
239
+ ╭─────────────────────── Success ───────────────────────╮
240
+ │ ✨ FastAPI project 'my-awesome-demo' from │
241
+ │ 'fastapi-default' has been created and saved to │
242
+ │ ~your-project-path~! │
243
+ ╰───────────────────────────────────────────────────────╯
244
+ ```
245
+
246
+ To view the list of available FastAPI demos, check with:
247
+
248
+ ```console
249
+ $ fastkit list-templates
250
+ Available Templates
251
+ ┌─────────────────────────┬───────────────────────────────────┐
252
+ │ fastapi-custom-response │ Async Item Management API with │
253
+ │ │ Custom Response System │
254
+ │ fastapi-dockerized │ Dockerized FastAPI Item │
255
+ │ │ Management API │
256
+ │ fastapi-empty │ No description │
257
+ │ fastapi-async-crud │ Async Item Management API Server │
258
+ │ fastapi-psql-orm │ Dockerized FastAPI Item │
259
+ │ │ Management API with PostgreSQL │
260
+ │ fastapi-default │ Simple FastAPI Project │
261
+ └─────────────────────────┴───────────────────────────────────┘
262
+ ```
263
+
264
+ ## Contributing
265
+
266
+ We welcome contributions from the community! FastAPI-fastkit is designed to help newcomers to Python and FastAPI, and your contributions can make a significant impact.
267
+
268
+ ### For Contributors
269
+
270
+ If you want to contribute to this project, we've made it easy to get started:
271
+
272
+ 1. **Quick Development Setup:**
273
+
274
+ fork or clone this repository:
275
+
276
+ ```bash
277
+ git clone https://github.com/bnbong/FastAPI-fastkit.git
278
+ cd FastAPI-fastkit
279
+ make dev-setup
280
+ ```
281
+
282
+ 2. **Available Development Commands:**
283
+
284
+ This project uses [Makefile](https://www.gnu.org/software/make/) to manage the development process.
285
+
286
+ You can use the following commands to help you get started:
287
+
288
+ ```bash
289
+ make help # See all available commands
290
+ make dev-check # Run all checks before submitting
291
+ make quick-test # Quick test after changes
292
+ ```
293
+
294
+ 3. **Read our contribution guidelines:**
295
+
296
+ For other contribution guidelines, please refer to the following files:
297
+
298
+ - [CONTRIBUTING.md](CONTRIBUTING.md) - Detailed contribution guide
299
+ - [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) - Project principles
300
+ - [SECURITY.md](SECURITY.md) - Security guidelines
301
+
302
+ ### What You Can Contribute
303
+
304
+ - 🚀 **New FastAPI templates** - Add templates for different use cases
305
+ - 🐛 **Bug fixes** - Help us improve stability and reliability
306
+ - 📚 **Documentation** - Improve guides, examples, and translations
307
+ - 🧪 **Tests** - Increase test coverage and add integration tests
308
+ - 💡 **Features** - Suggest and implement new CLI features
309
+
310
+ ## Significance of FastAPI-fastkit
311
+
312
+ FastAPI-fastkit aims to provide a fast and easy-to-use starter kit for new users of Python and FastAPI.
313
+
314
+ This idea was initiated with the aim of full fill to help FastAPI newcomers to learn from the beginning, which is the production significance of the FastAPI-cli package added with the [FastAPI 0.111.0 version update](https://github.com/fastapi/fastapi/releases/tag/0.111.0).
315
+
316
+ As one person who has been using and loving FastAPI for a long time, I wanted to develop a project that could help me a little bit to practice [the wonderful motivation](https://github.com/fastapi/fastapi/pull/11522#issuecomment-2264639417) that FastAPI developer [tiangolo](https://github.com/tiangolo) has.
317
+
318
+ ## License
319
+
320
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/bnbong/FastAPI-fastkit/blob/main/LICENSE) file for details.