jknife 0.0.10__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.
- {jknife-0.0.10 → jknife-0.0.12}/PKG-INFO +1 -1
- {jknife-0.0.10 → jknife-0.0.12}/pyproject.toml +1 -1
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/commands/jknife.py +28 -27
- {jknife-0.0.10 → jknife-0.0.12}/.gitignore +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/LICENSE +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/README.md +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/commands/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/mongo/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/mongo/network.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/mongo/personnel_info.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/mongo/settings.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/mongo/token.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/mongo/users.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/rdbms/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/rdbms/network.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/rdbms/personnel_info.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/rdbms/settings.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/rdbms/token.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/db/models/rdbms/users.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/dependencies/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/dependencies/token.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/dependencies/users.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/logging.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/views/__init__.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/views/error_message.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/views/personnel_info.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/views/tokens.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/jknife/views/users.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/src/settings_loader.py +0 -0
- {jknife-0.0.10 → jknife-0.0.12}/tests/__init__.py +0 -0
@@ -21,9 +21,9 @@ Usage: jknife [sub_command] [3rd argument]
|
|
21
21
|
--reload : reload uvicorn server automatically after editing source.
|
22
22
|
"""
|
23
23
|
|
24
|
-
# Template for
|
25
|
-
|
26
|
-
# import packages from default or pip library
|
24
|
+
# Template for APP_NAME.py in each folder.
|
25
|
+
MODULE_IMPORT_STRING_DICT: dict = {
|
26
|
+
"models": """# import packages from default or pip library
|
27
27
|
from typing_extensions import Annotated, Doc
|
28
28
|
|
29
29
|
# import packages from this framework below
|
@@ -33,10 +33,8 @@ from typing_extensions import Annotated, Doc
|
|
33
33
|
|
34
34
|
|
35
35
|
# define your own customising class below
|
36
|
-
"""
|
37
|
-
|
38
|
-
# Template for routers/APP_NAME.py
|
39
|
-
MODULE_IMPORT_STRING_ROUTERS: str = """# import packages from default or pip library
|
36
|
+
""",
|
37
|
+
"routers": """# import packages from default or pip library
|
40
38
|
from fastapi import APIRouter, Depends, status, HTTPException
|
41
39
|
from typing_extensions import Annotated, Doc
|
42
40
|
|
@@ -48,10 +46,8 @@ router = APIRouter(prefix="/{}",
|
|
48
46
|
tags=['{}'])
|
49
47
|
|
50
48
|
# define your own customising class below
|
51
|
-
"""
|
52
|
-
|
53
|
-
# Template for views/APP_NAME.py
|
54
|
-
MODULE_IMPORT_STRING_VIEWS: str = """# import packages from default or pip library
|
49
|
+
""",
|
50
|
+
"views": """# import packages from default or pip library
|
55
51
|
from pydantic import BaseModel, field_validator, ValidationError
|
56
52
|
|
57
53
|
# import packages from this framework below
|
@@ -62,13 +58,14 @@ from pydantic import BaseModel, field_validator, ValidationError
|
|
62
58
|
|
63
59
|
# define your own customising class below
|
64
60
|
"""
|
61
|
+
}
|
65
62
|
|
66
63
|
# WARN MSGs
|
67
64
|
WARN_MSG_ALREADY_EXIST_PROJECT: str = """
|
68
|
-
[WARNING] You already have project '{}'.
|
65
|
+
[WARNING] You already have project named '{}'.
|
69
66
|
"""
|
70
|
-
|
71
|
-
[WARNING] You have
|
67
|
+
WARN_MSG_ALREADY_EXIST_APP: str = """
|
68
|
+
[WARNING] You already have app named '{}'.
|
72
69
|
"""
|
73
70
|
|
74
71
|
# ERROR MSGs
|
@@ -78,6 +75,9 @@ ERROR_MSG_START_PROJECT: str = """
|
|
78
75
|
|
79
76
|
* Command for Starting Project: jknife startproject [PROJECT_NAME]
|
80
77
|
"""
|
78
|
+
ERROR_MSG_IMPOSSIBLE_RUNSERVER_OUT_OF_PROJECT: str = """
|
79
|
+
[ERROR] You have to execute 'runserver' command in your project folder.
|
80
|
+
"""
|
81
81
|
|
82
82
|
# File Contents
|
83
83
|
CONTENTS_IN_SETTINGS: str = """# this file is charge of config for custom fastapi.
|
@@ -319,24 +319,25 @@ def startproject(pjt_name: str) -> None:
|
|
319
319
|
def createapp(app_name: str) -> None:
|
320
320
|
# check main folders for jknife
|
321
321
|
for folder_name in FOLDER_LIST:
|
322
|
-
|
323
|
-
|
322
|
+
try:
|
323
|
+
if not os.listdir(folder_name):
|
324
324
|
with open(f"{folder_name}/__init__.py", "w") as f:
|
325
325
|
f.write("")
|
326
326
|
|
327
|
-
|
328
|
-
|
329
|
-
|
327
|
+
if f"{app_name}.py" not in os.listdir(folder_name):
|
328
|
+
with open(f"{folder_name}/{app_name}.py", "w") as f:
|
329
|
+
f.write(MODULE_IMPORT_STRING_DICT.get(folder_name))
|
330
330
|
|
331
|
-
|
332
|
-
|
333
|
-
f.write(MODULE_IMPORT_STRING_MODELS)
|
331
|
+
else:
|
332
|
+
raise AttributeError
|
334
333
|
|
335
|
-
|
336
|
-
|
334
|
+
except FileNotFoundError:
|
335
|
+
print(ERROR_MSG_START_PROJECT)
|
336
|
+
return None
|
337
337
|
|
338
|
-
|
339
|
-
|
338
|
+
except AttributeError:
|
339
|
+
print(WARN_MSG_ALREADY_EXIST_APP.format(app_name))
|
340
|
+
return None
|
340
341
|
|
341
342
|
return None
|
342
343
|
|
@@ -347,7 +348,7 @@ def help_msg():
|
|
347
348
|
def run_server(options: list, app_name: str = "main"):
|
348
349
|
for f in FOLDER_LIST:
|
349
350
|
if f not in os.listdir():
|
350
|
-
print(
|
351
|
+
print(ERROR_MSG_IMPOSSIBLE_RUNSERVER_OUT_OF_PROJECT)
|
351
352
|
return None
|
352
353
|
|
353
354
|
args = " ".join([ option.replace("=", " ") for option in options ])
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|