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.
- fastapi_fastkit/__init__.py +10 -1
- fastapi_fastkit/backend/main.py +482 -482
- fastapi_fastkit/backend/transducer.py +106 -106
- fastapi_fastkit/cli.py +664 -631
- fastapi_fastkit/core/settings.py +155 -155
- fastapi_fastkit/fastapi_project_template/README.md +90 -90
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/.gitignore-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/README.md-tpl +107 -107
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/requirements.txt-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/test.sh-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/setup.cfg-tpl +14 -14
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/setup.py-tpl +25 -25
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/api/api.py-tpl +9 -9
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/api/routes/items.py-tpl +57 -57
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/core/config.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/crud/items.py-tpl +21 -21
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/main.py-tpl +26 -26
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/schemas/items.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/tests/conftest.py-tpl +42 -42
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/tests/test_items.py-tpl +48 -48
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/.gitignore-tpl +191 -191
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/README.md-tpl +156 -156
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/requirements.txt-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/test.sh-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/setup.cfg-tpl +12 -12
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/setup.py-tpl +27 -27
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/.DS_Store +0 -0
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/api/api.py-tpl +9 -9
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/api/routes/items.py-tpl +172 -172
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/core/config.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/crud/items.py-tpl +21 -21
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/helper/exceptions.py-tpl +103 -103
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/helper/pagination.py-tpl +72 -72
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/main.py-tpl +39 -39
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/schemas/base.py-tpl +49 -49
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/schemas/items.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/utils/documents.py-tpl +20 -20
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/tests/conftest.py-tpl +42 -42
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/tests/test_items.py-tpl +61 -61
- fastapi_fastkit/fastapi_project_template/fastapi-default/README.md-tpl +101 -101
- fastapi_fastkit/fastapi_project_template/fastapi-default/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-default/setup.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-default/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-default/tests/conftest.py-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-default/tests/test_items.py-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/.gitignore-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/Dockerfile-tpl +23 -23
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/README.md-tpl +119 -119
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/requirements.txt-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/test.sh-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/setup.cfg-tpl +13 -13
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/setup.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/api/api.py-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/api/routes/items.py-tpl +54 -54
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/core/config.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/crud/items.py-tpl +15 -15
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/main.py-tpl +26 -26
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/schemas/items.py-tpl +19 -19
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/tests/conftest.py-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/tests/test_items.py-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/fastapi-empty/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-empty/setup.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-empty/src/core/config.py-tpl +75 -75
- fastapi_fastkit/fastapi_project_template/fastapi-empty/src/main.py-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/.env-tpl +9 -9
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/.gitignore-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/Dockerfile-tpl +23 -23
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/README.md-tpl +144 -144
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/alembic.ini-tpl +119 -119
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/docker-compose.yml-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/requirements.txt-tpl +41 -41
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/pre-start.sh-tpl +16 -16
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/test.sh-tpl +10 -10
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/setup.cfg-tpl +13 -13
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/setup.py-tpl +25 -25
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/README-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/env.py-tpl +85 -85
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/script.py.mako-tpl +26 -26
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/versions/bedcdc35b64a_first_alembic.py-tpl +37 -37
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/api.py-tpl +11 -11
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/deps.py-tpl +19 -19
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/routes/items.py-tpl +109 -109
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/core/config.py-tpl +88 -88
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/core/db.py-tpl +53 -53
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/crud/items.py-tpl +102 -102
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/main.py-tpl +45 -45
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/schemas/items.py-tpl +54 -54
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/backend_pre_start.py-tpl +39 -39
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/init_data.py-tpl +23 -23
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/tests_pre_start.py-tpl +39 -39
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/tests/conftest.py-tpl +63 -63
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/tests/test_items.py-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/modules/api/routes/new_route.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/modules/crud/new_route.py-tpl +29 -29
- fastapi_fastkit/fastapi_project_template/modules/schemas/new_route.py-tpl +23 -23
- fastapi_fastkit/logs/fastkit_debug_20250702_161423.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_162706.log +20 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_163010.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_163526.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_164053.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_165220.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_165647.log +21 -0
- fastapi_fastkit/utils/logging.py +112 -1
- fastapi_fastkit/utils/main.py +140 -129
- fastapi_fastkit-1.0.2.dist-info/METADATA +320 -0
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/RECORD +127 -119
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/WHEEL +1 -1
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/licenses/LICENSE +21 -21
- fastapi_fastkit-1.0.0.dist-info/METADATA +0 -208
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/entry_points.txt +0 -0
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
# --------------------------------------------------------------------------
|
|
2
|
-
# <new_route> CRUD method module
|
|
3
|
-
# --------------------------------------------------------------------------
|
|
4
|
-
def read_crud():
|
|
5
|
-
# Add Business Layer logics here
|
|
6
|
-
pass
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def create_crud():
|
|
10
|
-
# Add Business Layer logics here
|
|
11
|
-
pass
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def edit_crud():
|
|
15
|
-
# Add Business Layer logics here
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def remove_crud():
|
|
20
|
-
# Add Business Layer logics here
|
|
21
|
-
pass
|
|
22
|
-
|
|
23
|
-
"""Add other crud functions here
|
|
24
|
-
|
|
25
|
-
For more information, please refer to the following link:
|
|
26
|
-
|
|
27
|
-
https://fastapi.tiangolo.com/tutorial/first-steps/#operation
|
|
28
|
-
https://fastapi.tiangolo.com/tutorial/dependencies/
|
|
29
|
-
"""
|
|
1
|
+
# --------------------------------------------------------------------------
|
|
2
|
+
# <new_route> CRUD method module
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
def read_crud():
|
|
5
|
+
# Add Business Layer logics here
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_crud():
|
|
10
|
+
# Add Business Layer logics here
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def edit_crud():
|
|
15
|
+
# Add Business Layer logics here
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def remove_crud():
|
|
20
|
+
# Add Business Layer logics here
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
"""Add other crud functions here
|
|
24
|
+
|
|
25
|
+
For more information, please refer to the following link:
|
|
26
|
+
|
|
27
|
+
https://fastapi.tiangolo.com/tutorial/first-steps/#operation
|
|
28
|
+
https://fastapi.tiangolo.com/tutorial/dependencies/
|
|
29
|
+
"""
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# --------------------------------------------------------------------------
|
|
2
|
-
# <new_route> schema module
|
|
3
|
-
# --------------------------------------------------------------------------
|
|
4
|
-
from pydantic import BaseModel
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class <new_route>Base(BaseModel):
|
|
8
|
-
"""Add fields here"""
|
|
9
|
-
pass
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class <new_route>Response(<new_route>Base):
|
|
13
|
-
"""Add fields here"""
|
|
14
|
-
pass
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"""Add other schemas here
|
|
18
|
-
|
|
19
|
-
For more information, please refer to the following link:
|
|
20
|
-
|
|
21
|
-
https://fastapi.tiangolo.com/tutorial/query-param-models/
|
|
22
|
-
https://fastapi.tiangolo.com/tutorial/response-model/
|
|
23
|
-
"""
|
|
1
|
+
# --------------------------------------------------------------------------
|
|
2
|
+
# <new_route> schema module
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class <new_route>Base(BaseModel):
|
|
8
|
+
"""Add fields here"""
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class <new_route>Response(<new_route>Base):
|
|
13
|
+
"""Add fields here"""
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
"""Add other schemas here
|
|
18
|
+
|
|
19
|
+
For more information, please refer to the following link:
|
|
20
|
+
|
|
21
|
+
https://fastapi.tiangolo.com/tutorial/query-param-models/
|
|
22
|
+
https://fastapi.tiangolo.com/tutorial/response-model/
|
|
23
|
+
"""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[2025-07-02 16:14:23] [INFO] [fastapi-fastkit] Debug mode enabled. Logging to: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/logs/fastkit_debug_20250702_161423.log
|
|
2
|
+
[2025-07-02 16:14:23] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session started at 2025-07-02 16:14:23.428089
|
|
3
|
+
[2025-07-02 16:14:23] [STDOUT] [34mINFO [0m CLI invoked with debug mode:
|
|
4
|
+
[35m/Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/[0m[95m__main__.py[0m
|
|
5
|
+
--debug echo
|
|
6
|
+
[2025-07-02 16:14:23] [INFO] [fastapi-fastkit] CLI invoked with debug mode: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/__main__.py --debug echo
|
|
7
|
+
[2025-07-02 16:14:23] [STDOUT] ╭───────────────────────────────────────── About FastAPI-fastkit ──────────────────────────────────────────╮
|
|
8
|
+
│ │
|
|
9
|
+
│ ⚡️ FastAPI fastkit - fastest [1mFastAPI[0m initializer. ⚡️ │
|
|
10
|
+
│ │
|
|
11
|
+
│ Deploy FastAPI app foundation instantly at your local! │
|
|
12
|
+
│ │
|
|
13
|
+
│ --- │
|
|
14
|
+
│ - Project Maintainer : ]8;id=733200;mailto:bbbong9@gmail.com\bnbong(JunHyeok Lee)]8;;\ │
|
|
15
|
+
│ - Current Version : 1.0.2 │
|
|
16
|
+
│ - Github : https://github.com/bnbong/FastAPI-fastkit │
|
|
17
|
+
│ │
|
|
18
|
+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
19
|
+
[2025-07-02 16:14:23] [STDOUT] FASTKIT_PROJECT_ROOT: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src
|
|
20
|
+
USER_WORKSPACE: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit
|
|
21
|
+
[2025-07-02 16:14:23] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session ended
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[2025-07-02 16:27:06] [INFO] [fastapi-fastkit] Debug mode enabled. Logging to: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/logs/fastkit_debug_20250702_162706.log
|
|
2
|
+
[2025-07-02 16:27:06] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session started at 2025-07-02 16:27:06.952729
|
|
3
|
+
[2025-07-02 16:27:06] [STDOUT] INFO CLI invoked with debug mode:
|
|
4
|
+
/Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/
|
|
5
|
+
bin/pytest
|
|
6
|
+
[2025-07-02 16:27:06] [INFO] [fastapi-fastkit] CLI invoked with debug mode: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/bin/pytest
|
|
7
|
+
[2025-07-02 16:27:06] [STDOUT] ╭─────────────────────────── About FastAPI-fastkit ────────────────────────────╮
|
|
8
|
+
│ │
|
|
9
|
+
│ ⚡️ FastAPI fastkit - fastest FastAPI initializer. ⚡️ │
|
|
10
|
+
│ │
|
|
11
|
+
│ Deploy FastAPI app foundation instantly at your local! │
|
|
12
|
+
│ │
|
|
13
|
+
│ --- │
|
|
14
|
+
│ - Project Maintainer : bnbong(JunHyeok Lee) │
|
|
15
|
+
│ - Current Version : 1.0.2 │
|
|
16
|
+
│ - Github : https://github.com/bnbong/FastAPI-fastkit │
|
|
17
|
+
│ │
|
|
18
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
19
|
+
[2025-07-02 16:27:06] [STDOUT] FASTKIT_PROJECT_ROOT: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src
|
|
20
|
+
USER_WORKSPACE: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/tests/temp_test_workspace
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[2025-07-02 16:30:10] [INFO] [fastapi-fastkit] Debug mode enabled. Logging to: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/logs/fastkit_debug_20250702_163010.log
|
|
2
|
+
[2025-07-02 16:30:10] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session started at 2025-07-02 16:30:10.195309
|
|
3
|
+
[2025-07-02 16:30:10] [STDOUT] INFO CLI invoked with debug mode:
|
|
4
|
+
/Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/
|
|
5
|
+
bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing
|
|
6
|
+
--cov-report=html --cov-report=xml --cov-fail-under=70
|
|
7
|
+
[2025-07-02 16:30:10] [INFO] [fastapi-fastkit] CLI invoked with debug mode: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing --cov-report=html --cov-report=xml --cov-fail-under=70
|
|
8
|
+
[2025-07-02 16:30:10] [STDOUT] ╭─────────────────────────── About FastAPI-fastkit ────────────────────────────╮
|
|
9
|
+
│ │
|
|
10
|
+
│ ⚡️ FastAPI fastkit - fastest FastAPI initializer. ⚡️ │
|
|
11
|
+
│ │
|
|
12
|
+
│ Deploy FastAPI app foundation instantly at your local! │
|
|
13
|
+
│ │
|
|
14
|
+
│ --- │
|
|
15
|
+
│ - Project Maintainer : bnbong(JunHyeok Lee) │
|
|
16
|
+
│ - Current Version : 1.0.2 │
|
|
17
|
+
│ - Github : https://github.com/bnbong/FastAPI-fastkit │
|
|
18
|
+
│ │
|
|
19
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
20
|
+
[2025-07-02 16:30:10] [STDOUT] FASTKIT_PROJECT_ROOT: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src
|
|
21
|
+
USER_WORKSPACE: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/tests/temp_test_workspace
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[2025-07-02 16:35:26] [INFO] [fastapi-fastkit] Debug mode enabled. Logging to: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/logs/fastkit_debug_20250702_163526.log
|
|
2
|
+
[2025-07-02 16:35:26] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session started at 2025-07-02 16:35:26.150916
|
|
3
|
+
[2025-07-02 16:35:26] [STDOUT] INFO CLI invoked with debug mode:
|
|
4
|
+
/Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/
|
|
5
|
+
bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing
|
|
6
|
+
--cov-report=html --cov-report=xml --cov-fail-under=70
|
|
7
|
+
[2025-07-02 16:35:26] [INFO] [fastapi-fastkit] CLI invoked with debug mode: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing --cov-report=html --cov-report=xml --cov-fail-under=70
|
|
8
|
+
[2025-07-02 16:35:26] [STDOUT] ╭─────────────────────────── About FastAPI-fastkit ────────────────────────────╮
|
|
9
|
+
│ │
|
|
10
|
+
│ ⚡️ FastAPI fastkit - fastest FastAPI initializer. ⚡️ │
|
|
11
|
+
│ │
|
|
12
|
+
│ Deploy FastAPI app foundation instantly at your local! │
|
|
13
|
+
│ │
|
|
14
|
+
│ --- │
|
|
15
|
+
│ - Project Maintainer : bnbong(JunHyeok Lee) │
|
|
16
|
+
│ - Current Version : 1.0.2 │
|
|
17
|
+
│ - Github : https://github.com/bnbong/FastAPI-fastkit │
|
|
18
|
+
│ │
|
|
19
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
20
|
+
[2025-07-02 16:35:26] [STDOUT] FASTKIT_PROJECT_ROOT: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src
|
|
21
|
+
USER_WORKSPACE: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/tests/temp_test_workspace
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[2025-07-02 16:40:53] [INFO] [fastapi-fastkit] Debug mode enabled. Logging to: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/logs/fastkit_debug_20250702_164053.log
|
|
2
|
+
[2025-07-02 16:40:53] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session started at 2025-07-02 16:40:53.692239
|
|
3
|
+
[2025-07-02 16:40:53] [STDOUT] INFO CLI invoked with debug mode:
|
|
4
|
+
/Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/
|
|
5
|
+
bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing
|
|
6
|
+
--cov-report=html --cov-report=xml --cov-fail-under=70
|
|
7
|
+
[2025-07-02 16:40:53] [INFO] [fastapi-fastkit] CLI invoked with debug mode: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing --cov-report=html --cov-report=xml --cov-fail-under=70
|
|
8
|
+
[2025-07-02 16:40:53] [STDOUT] ╭─────────────────────────── About FastAPI-fastkit ────────────────────────────╮
|
|
9
|
+
│ │
|
|
10
|
+
│ ⚡️ FastAPI fastkit - fastest FastAPI initializer. ⚡️ │
|
|
11
|
+
│ │
|
|
12
|
+
│ Deploy FastAPI app foundation instantly at your local! │
|
|
13
|
+
│ │
|
|
14
|
+
│ --- │
|
|
15
|
+
│ - Project Maintainer : bnbong(JunHyeok Lee) │
|
|
16
|
+
│ - Current Version : 1.0.2 │
|
|
17
|
+
│ - Github : https://github.com/bnbong/FastAPI-fastkit │
|
|
18
|
+
│ │
|
|
19
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
20
|
+
[2025-07-02 16:40:53] [STDOUT] FASTKIT_PROJECT_ROOT: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src
|
|
21
|
+
USER_WORKSPACE: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/tests/temp_test_workspace
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[2025-07-02 16:52:20] [INFO] [fastapi-fastkit] Debug mode enabled. Logging to: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/logs/fastkit_debug_20250702_165220.log
|
|
2
|
+
[2025-07-02 16:52:20] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session started at 2025-07-02 16:52:20.341927
|
|
3
|
+
[2025-07-02 16:52:20] [STDOUT] INFO CLI invoked with debug mode:
|
|
4
|
+
/Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/
|
|
5
|
+
bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing
|
|
6
|
+
--cov-report=html --cov-report=xml --cov-fail-under=70
|
|
7
|
+
[2025-07-02 16:52:20] [INFO] [fastapi-fastkit] CLI invoked with debug mode: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing --cov-report=html --cov-report=xml --cov-fail-under=70
|
|
8
|
+
[2025-07-02 16:52:20] [STDOUT] ╭─────────────────────────── About FastAPI-fastkit ────────────────────────────╮
|
|
9
|
+
│ │
|
|
10
|
+
│ ⚡️ FastAPI fastkit - fastest FastAPI initializer. ⚡️ │
|
|
11
|
+
│ │
|
|
12
|
+
│ Deploy FastAPI app foundation instantly at your local! │
|
|
13
|
+
│ │
|
|
14
|
+
│ --- │
|
|
15
|
+
│ - Project Maintainer : bnbong(JunHyeok Lee) │
|
|
16
|
+
│ - Current Version : 1.0.2 │
|
|
17
|
+
│ - Github : https://github.com/bnbong/FastAPI-fastkit │
|
|
18
|
+
│ │
|
|
19
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
20
|
+
[2025-07-02 16:52:20] [STDOUT] FASTKIT_PROJECT_ROOT: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src
|
|
21
|
+
USER_WORKSPACE: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/tests/temp_test_workspace
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[2025-07-02 16:56:47] [INFO] [fastapi-fastkit] Debug mode enabled. Logging to: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src/fastapi_fastkit/logs/fastkit_debug_20250702_165647.log
|
|
2
|
+
[2025-07-02 16:56:47] [INFO] [fastapi-fastkit] FastAPI-fastkit CLI session started at 2025-07-02 16:56:47.965182
|
|
3
|
+
[2025-07-02 16:56:47] [STDOUT] INFO CLI invoked with debug mode:
|
|
4
|
+
/Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/
|
|
5
|
+
bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing
|
|
6
|
+
--cov-report=html --cov-report=xml --cov-fail-under=70
|
|
7
|
+
[2025-07-02 16:56:47] [INFO] [fastapi-fastkit] CLI invoked with debug mode: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/.venv/bin/pytest --cov=src/fastapi_fastkit --cov-report=term-missing --cov-report=html --cov-report=xml --cov-fail-under=70
|
|
8
|
+
[2025-07-02 16:56:47] [STDOUT] ╭─────────────────────────── About FastAPI-fastkit ────────────────────────────╮
|
|
9
|
+
│ │
|
|
10
|
+
│ ⚡️ FastAPI fastkit - fastest FastAPI initializer. ⚡️ │
|
|
11
|
+
│ │
|
|
12
|
+
│ Deploy FastAPI app foundation instantly at your local! │
|
|
13
|
+
│ │
|
|
14
|
+
│ --- │
|
|
15
|
+
│ - Project Maintainer : bnbong(JunHyeok Lee) │
|
|
16
|
+
│ - Current Version : 1.0.2 │
|
|
17
|
+
│ - Github : https://github.com/bnbong/FastAPI-fastkit │
|
|
18
|
+
│ │
|
|
19
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
20
|
+
[2025-07-02 16:56:47] [STDOUT] FASTKIT_PROJECT_ROOT: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/src
|
|
21
|
+
USER_WORKSPACE: /Users/bnbong/Documents/WorkstationFiles/programming/FastAPI-kit/tests/temp_test_workspace
|
fastapi_fastkit/utils/logging.py
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
# @author bnbong bbbong9@gmail.com
|
|
8
8
|
# --------------------------------------------------------------------------
|
|
9
9
|
import logging
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
from datetime import datetime
|
|
10
13
|
from typing import Union
|
|
11
14
|
|
|
12
15
|
from rich.console import Console
|
|
@@ -15,9 +18,82 @@ from rich.logging import RichHandler
|
|
|
15
18
|
from fastapi_fastkit.core.settings import FastkitConfig
|
|
16
19
|
|
|
17
20
|
|
|
21
|
+
class DebugFileHandler(logging.Handler):
|
|
22
|
+
"""Custom logging handler for debug mode that captures all output."""
|
|
23
|
+
|
|
24
|
+
def __init__(self, log_file_path: str):
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.log_file_path = log_file_path
|
|
27
|
+
# Ensure log directory exists
|
|
28
|
+
os.makedirs(os.path.dirname(log_file_path), exist_ok=True)
|
|
29
|
+
|
|
30
|
+
def emit(self, record: logging.LogRecord) -> None:
|
|
31
|
+
try:
|
|
32
|
+
log_entry = self.format(record)
|
|
33
|
+
with open(self.log_file_path, "a", encoding="utf-8") as f:
|
|
34
|
+
f.write(f"{log_entry}\n")
|
|
35
|
+
except Exception:
|
|
36
|
+
self.handleError(record)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class DebugOutputCapture:
|
|
40
|
+
"""Captures stdout and stderr to log file in debug mode."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, log_file_path: str):
|
|
43
|
+
self.log_file_path = log_file_path
|
|
44
|
+
self.original_stdout = sys.stdout
|
|
45
|
+
self.original_stderr = sys.stderr
|
|
46
|
+
|
|
47
|
+
def __enter__(self) -> "DebugOutputCapture":
|
|
48
|
+
# Create a custom writer that writes to both original output and log file
|
|
49
|
+
class TeeWriter:
|
|
50
|
+
def __init__(
|
|
51
|
+
self, original: object, log_file: str, stream_type: str
|
|
52
|
+
) -> None:
|
|
53
|
+
self.original = original
|
|
54
|
+
self.log_file = log_file
|
|
55
|
+
self.stream_type = stream_type
|
|
56
|
+
|
|
57
|
+
def write(self, text: str) -> None:
|
|
58
|
+
# Write to original stream
|
|
59
|
+
if hasattr(self.original, "write") and hasattr(self.original, "flush"):
|
|
60
|
+
self.original.write(text)
|
|
61
|
+
self.original.flush()
|
|
62
|
+
|
|
63
|
+
# Write to log file with timestamp and stream type
|
|
64
|
+
if text.strip(): # Only log non-empty lines
|
|
65
|
+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
66
|
+
try:
|
|
67
|
+
with open(self.log_file, "a", encoding="utf-8") as f:
|
|
68
|
+
f.write(f"[{timestamp}] [{self.stream_type}] {text}")
|
|
69
|
+
if not text.endswith("\n"):
|
|
70
|
+
f.write("\n")
|
|
71
|
+
except Exception:
|
|
72
|
+
pass # Fail silently if logging fails
|
|
73
|
+
|
|
74
|
+
def flush(self) -> None:
|
|
75
|
+
if hasattr(self.original, "flush"):
|
|
76
|
+
self.original.flush()
|
|
77
|
+
|
|
78
|
+
sys.stdout = TeeWriter(self.original_stdout, self.log_file_path, "STDOUT")
|
|
79
|
+
sys.stderr = TeeWriter(self.original_stderr, self.log_file_path, "STDERR")
|
|
80
|
+
return self
|
|
81
|
+
|
|
82
|
+
def __exit__(self, exc_type: object, exc_val: object, exc_tb: object) -> None:
|
|
83
|
+
sys.stdout = self.original_stdout
|
|
84
|
+
sys.stderr = self.original_stderr
|
|
85
|
+
|
|
86
|
+
|
|
18
87
|
def setup_logging(
|
|
19
88
|
settings: FastkitConfig, terminal_width: Union[int, None] = None
|
|
20
|
-
) -> None:
|
|
89
|
+
) -> Union[DebugOutputCapture, None]:
|
|
90
|
+
"""
|
|
91
|
+
Setup logging for fastapi-fastkit.
|
|
92
|
+
|
|
93
|
+
:param settings: FastkitConfig instance
|
|
94
|
+
:param terminal_width: Optional terminal width for Rich console
|
|
95
|
+
:return: DebugOutputCapture instance if debug mode is enabled, None otherwise
|
|
96
|
+
"""
|
|
21
97
|
logger = logging.getLogger("fastapi-fastkit")
|
|
22
98
|
console = Console(width=terminal_width) if terminal_width else None
|
|
23
99
|
formatter = logging.Formatter("%(message)s")
|
|
@@ -34,3 +110,38 @@ def setup_logging(
|
|
|
34
110
|
|
|
35
111
|
logger.setLevel(settings.LOGGING_LEVEL)
|
|
36
112
|
logger.propagate = False
|
|
113
|
+
|
|
114
|
+
# Clear existing handlers
|
|
115
|
+
logger.handlers.clear()
|
|
116
|
+
logger.addHandler(rich_handler)
|
|
117
|
+
|
|
118
|
+
# If debug mode is enabled, add file logging
|
|
119
|
+
debug_capture = None
|
|
120
|
+
if settings.DEBUG_MODE:
|
|
121
|
+
# Create logs directory in the package source
|
|
122
|
+
logs_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "logs")
|
|
123
|
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
124
|
+
log_file_path = os.path.join(logs_dir, f"fastkit_debug_{timestamp}.log")
|
|
125
|
+
|
|
126
|
+
# Add file handler for logger
|
|
127
|
+
file_handler = DebugFileHandler(log_file_path)
|
|
128
|
+
file_formatter = logging.Formatter(
|
|
129
|
+
"[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s",
|
|
130
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
|
131
|
+
)
|
|
132
|
+
file_handler.setFormatter(file_formatter)
|
|
133
|
+
logger.addHandler(file_handler)
|
|
134
|
+
|
|
135
|
+
# Create output capture for stdout/stderr
|
|
136
|
+
debug_capture = DebugOutputCapture(log_file_path)
|
|
137
|
+
|
|
138
|
+
# Log the start of debug session
|
|
139
|
+
logger.info(f"Debug mode enabled. Logging to: {log_file_path}")
|
|
140
|
+
logger.info(f"FastAPI-fastkit CLI session started at {datetime.now()}")
|
|
141
|
+
|
|
142
|
+
return debug_capture
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def get_logger(name: str = "fastapi-fastkit") -> logging.Logger:
|
|
146
|
+
"""Get a logger instance."""
|
|
147
|
+
return logging.getLogger(name)
|