wiederverwendbar 0.8.6__py3-none-any.whl → 0.9.0__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.
- wiederverwendbar/__init__.py +8 -6
- wiederverwendbar/branding/__init__.py +1 -0
- wiederverwendbar/branding/settings.py +85 -0
- wiederverwendbar/console/__init__.py +3 -0
- wiederverwendbar/console/console.py +199 -0
- wiederverwendbar/console/out_files.py +19 -0
- wiederverwendbar/console/settings.py +9 -0
- wiederverwendbar/default.py +4 -1
- wiederverwendbar/fastapi/__init__.py +3 -0
- wiederverwendbar/fastapi/app.py +385 -0
- wiederverwendbar/fastapi/dependencies.py +11 -0
- wiederverwendbar/fastapi/settings.py +39 -0
- wiederverwendbar/functions/is_coroutine_function.py +19 -0
- wiederverwendbar/inspect.py +26 -0
- wiederverwendbar/logger/__init__.py +0 -1
- wiederverwendbar/logger/handlers/rich_console_handler.py +15 -6
- wiederverwendbar/logger/handlers/stream_console_handler.py +3 -16
- wiederverwendbar/logger/log_levels.py +2 -3
- wiederverwendbar/logger/settings.py +15 -20
- wiederverwendbar/rich/__init__.py +2 -0
- wiederverwendbar/rich/console.py +215 -0
- wiederverwendbar/rich/settings.py +26 -0
- wiederverwendbar/typer/__init__.py +3 -1
- wiederverwendbar/typer/app.py +172 -0
- wiederverwendbar/typer/settings.py +14 -0
- {wiederverwendbar-0.8.6.dist-info → wiederverwendbar-0.9.0.dist-info}/METADATA +9 -6
- {wiederverwendbar-0.8.6.dist-info → wiederverwendbar-0.9.0.dist-info}/RECORD +29 -45
- wiederverwendbar/examples/__init__.py +0 -0
- wiederverwendbar/examples/before_after_wrap.py +0 -74
- wiederverwendbar/examples/colors.py +0 -16
- wiederverwendbar/examples/extended_thread.py +0 -28
- wiederverwendbar/examples/file_config.py +0 -11
- wiederverwendbar/examples/indexable_model.py +0 -19
- wiederverwendbar/examples/logger.py +0 -31
- wiederverwendbar/examples/logger_context/__init__.py +0 -0
- wiederverwendbar/examples/logger_context/example.py +0 -58
- wiederverwendbar/examples/logger_context/example_module.py +0 -13
- wiederverwendbar/examples/mongoengine/__init__.py +0 -0
- wiederverwendbar/examples/mongoengine/automatic_reference.py +0 -25
- wiederverwendbar/examples/mongoengine/db.py +0 -7
- wiederverwendbar/examples/mongoengine/log_streamer.py +0 -9
- wiederverwendbar/examples/mongoengine/logger.py +0 -25
- wiederverwendbar/examples/post_init.py +0 -29
- wiederverwendbar/examples/route.py +0 -12
- wiederverwendbar/examples/singletons.py +0 -59
- wiederverwendbar/examples/sqlalchemy/__init__.py +0 -0
- wiederverwendbar/examples/sqlalchemy/db.py +0 -89
- wiederverwendbar/examples/starlette_admin/__init__.py +0 -0
- wiederverwendbar/examples/starlette_admin/action_log.py +0 -126
- wiederverwendbar/examples/starlette_admin/action_log_file_download.py +0 -99
- wiederverwendbar/examples/starlette_admin/action_log_form.py +0 -149
- wiederverwendbar/examples/starlette_admin/action_log_thread.py +0 -192
- wiederverwendbar/examples/starlette_admin/automatic_reference_admin.py +0 -47
- wiederverwendbar/examples/starlette_admin/generic_embedded_document_field.py +0 -74
- wiederverwendbar/examples/starlette_admin/multi_path_admin.py +0 -18
- wiederverwendbar/examples/task_manager.py +0 -55
- wiederverwendbar/examples/test_file.py +0 -14
- wiederverwendbar/examples/typer_resolve_defaults.py +0 -15
- wiederverwendbar/examples/uvicorn_server.py +0 -32
- wiederverwendbar/logger/terminal_out_files.py +0 -10
- {wiederverwendbar-0.8.6.dist-info → wiederverwendbar-0.9.0.dist-info}/WHEEL +0 -0
- {wiederverwendbar-0.8.6.dist-info → wiederverwendbar-0.9.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,215 @@
|
|
1
|
+
from typing import Optional, Literal, Union, Any
|
2
|
+
|
3
|
+
from rich.console import Console as _RichConsole
|
4
|
+
|
5
|
+
from wiederverwendbar.console.console import Console as _Console
|
6
|
+
from wiederverwendbar.console.out_files import OutFiles
|
7
|
+
from wiederverwendbar.rich.settings import RichConsoleSettings
|
8
|
+
|
9
|
+
|
10
|
+
class RichConsole(_Console, _RichConsole):
|
11
|
+
print_function = _RichConsole.print
|
12
|
+
print_function_blacklist_kwargs = _Console.print_function_blacklist_kwargs + ["color", "header_color", "border_color"]
|
13
|
+
|
14
|
+
def __init__(self,
|
15
|
+
*,
|
16
|
+
console_file: Optional[OutFiles] = None,
|
17
|
+
console_seperator: Optional[str] = None,
|
18
|
+
console_end: Optional[str] = None,
|
19
|
+
console_color_system: Optional[Literal["auto", "standard", "256", "truecolor", "windows"]] = None,
|
20
|
+
console_force_terminal: Optional[bool] = None,
|
21
|
+
console_force_jupyter: Optional[bool] = None,
|
22
|
+
console_force_interactive: Optional[bool] = None,
|
23
|
+
console_soft_wrap: Optional[bool] = None,
|
24
|
+
console_quiet: Optional[bool] = None,
|
25
|
+
console_width: Optional[int] = None,
|
26
|
+
console_height: Optional[int] = None,
|
27
|
+
console_no_color: Optional[bool] = None,
|
28
|
+
console_tab_size: Optional[int] = None,
|
29
|
+
console_record: Optional[bool] = None,
|
30
|
+
console_markup: Optional[bool] = None,
|
31
|
+
console_emoji: Optional[bool] = None,
|
32
|
+
console_emoji_variant: Optional[Literal["emoji", "text"]] = None,
|
33
|
+
console_highlight: Optional[bool] = None,
|
34
|
+
console_log_time: Optional[bool] = None,
|
35
|
+
console_log_path: Optional[bool] = None,
|
36
|
+
settings: Optional[RichConsoleSettings] = None,
|
37
|
+
**kwargs):
|
38
|
+
"""
|
39
|
+
Create a new rich console.
|
40
|
+
|
41
|
+
:param console_file: Console file. Default is STDOUT.
|
42
|
+
:param console_seperator: Console seperator. Default is a space.
|
43
|
+
:param console_end: Console end. Default is a newline.
|
44
|
+
:param console_color_system: Rich Console color system.
|
45
|
+
:param console_force_terminal: Rich Console force terminal.
|
46
|
+
:param console_force_jupyter: Rich Console force jupyter.
|
47
|
+
:param console_force_interactive: Rich Console force interactive.
|
48
|
+
:param console_soft_wrap: Rich Console soft wrap.
|
49
|
+
:param console_quiet: Rich Console quiet.
|
50
|
+
:param console_width: Rich Console width.
|
51
|
+
:param console_height: Rich Console height.
|
52
|
+
:param console_no_color: Rich Console no color.
|
53
|
+
:param console_tab_size: Rich Console tab size.
|
54
|
+
:param console_record: Rich Console record.
|
55
|
+
:param console_markup: Rich Console markup.
|
56
|
+
:param console_emoji: Rich Console emoji.
|
57
|
+
:param console_emoji_variant: Rich Console emoji variant.
|
58
|
+
:param console_highlight: Rich Console highlight.
|
59
|
+
:param console_log_time: Rich Console log time.
|
60
|
+
:param console_log_path: Rich Console log path.
|
61
|
+
:param settings: A settings object to use. If None, defaults to ConsoleSettings().
|
62
|
+
"""
|
63
|
+
|
64
|
+
if settings is None:
|
65
|
+
settings = RichConsoleSettings()
|
66
|
+
|
67
|
+
_Console.__init__(self,
|
68
|
+
console_file=console_file,
|
69
|
+
console_seperator=console_seperator,
|
70
|
+
console_end=console_end,
|
71
|
+
settings=settings)
|
72
|
+
|
73
|
+
if console_color_system is None:
|
74
|
+
console_color_system = settings.console_color_system
|
75
|
+
|
76
|
+
if console_force_terminal is None:
|
77
|
+
console_force_terminal = settings.console_force_terminal
|
78
|
+
|
79
|
+
if console_force_jupyter is None:
|
80
|
+
console_force_jupyter = settings.console_force_jupyter
|
81
|
+
|
82
|
+
if console_force_interactive is None:
|
83
|
+
console_force_interactive = settings.console_force_interactive
|
84
|
+
|
85
|
+
if console_soft_wrap is None:
|
86
|
+
console_soft_wrap = settings.console_soft_wrap
|
87
|
+
|
88
|
+
if console_quiet is None:
|
89
|
+
console_quiet = settings.console_quiet
|
90
|
+
|
91
|
+
if console_width is None:
|
92
|
+
console_width = settings.console_width
|
93
|
+
|
94
|
+
if console_height is None:
|
95
|
+
console_height = settings.console_height
|
96
|
+
|
97
|
+
if console_no_color is None:
|
98
|
+
console_no_color = settings.console_no_color
|
99
|
+
|
100
|
+
if console_tab_size is None:
|
101
|
+
console_tab_size = settings.console_tab_size
|
102
|
+
|
103
|
+
if console_record is None:
|
104
|
+
console_record = settings.console_record
|
105
|
+
|
106
|
+
if console_markup is None:
|
107
|
+
console_markup = settings.console_markup
|
108
|
+
|
109
|
+
if console_emoji is None:
|
110
|
+
console_emoji = settings.console_emoji
|
111
|
+
|
112
|
+
if console_emoji_variant is None:
|
113
|
+
console_emoji_variant = settings.console_emoji_variant
|
114
|
+
|
115
|
+
if console_highlight is None:
|
116
|
+
console_highlight = settings.console_highlight
|
117
|
+
|
118
|
+
if console_log_time is None:
|
119
|
+
console_log_time = settings.console_log_time
|
120
|
+
|
121
|
+
if console_log_path is None:
|
122
|
+
console_log_path = settings.console_log_path
|
123
|
+
|
124
|
+
_RichConsole.__init__(self,
|
125
|
+
color_system=console_color_system,
|
126
|
+
force_terminal=console_force_terminal,
|
127
|
+
force_jupyter=console_force_jupyter,
|
128
|
+
force_interactive=console_force_interactive,
|
129
|
+
soft_wrap=console_soft_wrap,
|
130
|
+
quiet=console_quiet,
|
131
|
+
width=console_width,
|
132
|
+
height=console_height,
|
133
|
+
no_color=console_no_color,
|
134
|
+
tab_size=console_tab_size,
|
135
|
+
record=console_record,
|
136
|
+
markup=console_markup,
|
137
|
+
emoji=console_emoji,
|
138
|
+
emoji_variant=console_emoji_variant,
|
139
|
+
highlight=console_highlight,
|
140
|
+
log_time=console_log_time,
|
141
|
+
log_path=console_log_path,
|
142
|
+
**kwargs)
|
143
|
+
|
144
|
+
def _card_kwargs(self, mode: Literal["text", "header", "border", "print"], **kwargs) -> dict[str, Any]:
|
145
|
+
out = super()._card_kwargs(mode=mode, **kwargs)
|
146
|
+
for key in kwargs:
|
147
|
+
if mode == "text":
|
148
|
+
if key not in ["color"]:
|
149
|
+
continue
|
150
|
+
out[key] = kwargs[key]
|
151
|
+
elif mode == "header":
|
152
|
+
if key not in ["header_color"]:
|
153
|
+
continue
|
154
|
+
out[key] = kwargs[key]
|
155
|
+
elif mode == "border":
|
156
|
+
if key not in ["border_color"]:
|
157
|
+
continue
|
158
|
+
out[key] = kwargs[key]
|
159
|
+
return out
|
160
|
+
|
161
|
+
def _card_get_text(self,
|
162
|
+
text: str,
|
163
|
+
color: Optional[str] = None,
|
164
|
+
**kwargs) -> str:
|
165
|
+
text = super()._card_get_text(text=text,
|
166
|
+
**kwargs)
|
167
|
+
if color is not None:
|
168
|
+
text = f"[{color}]{text}[/{color}]"
|
169
|
+
return text
|
170
|
+
|
171
|
+
def _card_get_header_text(self,
|
172
|
+
text: str,
|
173
|
+
header_color: Optional[str] = None,
|
174
|
+
**kwargs) -> str:
|
175
|
+
text = super()._card_get_header_text(text=text,
|
176
|
+
**kwargs)
|
177
|
+
if header_color is not None:
|
178
|
+
text = f"[{header_color}]{text}[/{header_color}]"
|
179
|
+
return text
|
180
|
+
|
181
|
+
def _card_get_border(self,
|
182
|
+
border_style: Literal["single_line", "double_line"],
|
183
|
+
border_part: Literal["horizontal", "vertical", "top_left", "top_right", "bottom_left", "bottom_right", "vertical_left", "vertical_right"],
|
184
|
+
border_color: Optional[str] = None,
|
185
|
+
**kwargs):
|
186
|
+
border = super()._card_get_border(border_style=border_style,
|
187
|
+
border_part=border_part,
|
188
|
+
**kwargs)
|
189
|
+
if border_color is not None:
|
190
|
+
border = f"[{border_color}]{border}[/{border_color}]"
|
191
|
+
return border
|
192
|
+
|
193
|
+
def card(self,
|
194
|
+
*sections: Union[str, tuple[str, str]],
|
195
|
+
min_width: Optional[int] = None,
|
196
|
+
max_width: Optional[int] = None,
|
197
|
+
border_style: Literal["single_line", "double_line"] = "single_line",
|
198
|
+
topic_offest: int = 1,
|
199
|
+
padding_left: int = 0,
|
200
|
+
padding_right: int = 0,
|
201
|
+
color: Optional[str] = None,
|
202
|
+
header_color: Optional[str] = None,
|
203
|
+
border_color: Optional[str] = None,
|
204
|
+
**kwargs) -> None:
|
205
|
+
return super().card(*sections,
|
206
|
+
min_width=min_width,
|
207
|
+
max_width=max_width,
|
208
|
+
border_style=border_style,
|
209
|
+
topic_offest=topic_offest,
|
210
|
+
padding_left=padding_left,
|
211
|
+
padding_right=padding_right,
|
212
|
+
color=color,
|
213
|
+
header_color=header_color,
|
214
|
+
border_color=border_color,
|
215
|
+
**kwargs)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from typing import Optional, Literal
|
2
|
+
|
3
|
+
from pydantic import Field
|
4
|
+
|
5
|
+
from wiederverwendbar.console.settings import ConsoleSettings
|
6
|
+
|
7
|
+
|
8
|
+
class RichConsoleSettings(ConsoleSettings):
|
9
|
+
console_color_system: Optional[Literal["auto", "standard", "256", "truecolor", "windows"]] = Field(default="auto", title="Console Color System",
|
10
|
+
description="The color system of the console.")
|
11
|
+
console_force_terminal: Optional[bool] = Field(default=None, title="Console Force Terminal", description="Whether to force the terminal.")
|
12
|
+
console_force_jupyter: Optional[bool] = Field(default=None, title="Console Force Jupyter", description="Whether to force Jupyter.")
|
13
|
+
console_force_interactive: Optional[bool] = Field(default=None, title="Console Force Interactive", description="Whether to force interactive mode.")
|
14
|
+
console_soft_wrap: bool = Field(default=False, title="Console Soft Wrap", description="Whether to soft wrap the console.")
|
15
|
+
console_quiet: bool = Field(default=False, title="Console Quiet", description="Whether to suppress all output.")
|
16
|
+
console_width: Optional[int] = Field(default=None, title="Console Width", description="The width of the console.")
|
17
|
+
console_height: Optional[int] = Field(default=None, title="Console Height", description="The height of the console.")
|
18
|
+
console_no_color: Optional[bool] = Field(default=None, title="Console No Color", description="Whether to disable color.")
|
19
|
+
console_tab_size: int = Field(default=8, title="Console Tab Size", description="The tab size of the console.")
|
20
|
+
console_record: bool = Field(default=False, title="Console Record", description="Whether to record the console output.")
|
21
|
+
console_markup: bool = Field(default=True, title="Console Markup", description="Whether to enable markup.")
|
22
|
+
console_emoji: bool = Field(default=True, title="Console Emoji", description="Whether to enable emoji.")
|
23
|
+
console_emoji_variant: Optional[Literal["emoji", "text"]] = Field(default=None, title="Console Emoji Variant", description="The emoji variant of the console.")
|
24
|
+
console_highlight: bool = Field(default=True, title="Console Highlight", description="Whether to enable highlighting.")
|
25
|
+
console_log_time: bool = Field(default=True, title="Console Log Time", description="Whether to log the time.")
|
26
|
+
console_log_path: bool = Field(default=True, title="Console Log Path", description="Whether to log the path (logging of the caller by).")
|
@@ -1 +1,3 @@
|
|
1
|
-
from wiederverwendbar.typer.
|
1
|
+
from wiederverwendbar.typer.app import (Typer)
|
2
|
+
from wiederverwendbar.typer.settings import (TyperSettings)
|
3
|
+
from wiederverwendbar.typer.typer_resolve_defaults import (typer_resolve_defaults)
|
@@ -0,0 +1,172 @@
|
|
1
|
+
import inspect
|
2
|
+
from typing import Optional, Annotated, Union
|
3
|
+
|
4
|
+
from typer import Typer as _Typer, Option, Exit
|
5
|
+
from art import text2art
|
6
|
+
|
7
|
+
from wiederverwendbar.default import Default
|
8
|
+
from wiederverwendbar.rich.console import RichConsole
|
9
|
+
from wiederverwendbar.typer.settings import TyperSettings
|
10
|
+
|
11
|
+
|
12
|
+
class Typer(_Typer):
|
13
|
+
def __init__(self,
|
14
|
+
*,
|
15
|
+
title: Union[Default, str] = Default(),
|
16
|
+
description: Union[None, Default, str] = Default(),
|
17
|
+
version: Union[Default, str] = Default(),
|
18
|
+
author: Union[None, Default, str] = Default(),
|
19
|
+
author_email: Union[None, Default, str] = Default(),
|
20
|
+
license: Union[None, Default, str] = Default(),
|
21
|
+
license_url: Union[None, Default, str] = Default(),
|
22
|
+
terms_of_service: Union[None, Default, str] = Default(),
|
23
|
+
info_enabled: Union[Default, bool] = Default(),
|
24
|
+
version_enabled: Union[Default, bool] = Default(),
|
25
|
+
name: Union[None, Default, str] = Default(),
|
26
|
+
help: Union[None, Default, str] = Default(),
|
27
|
+
settings: Optional[TyperSettings] = None,
|
28
|
+
console: Optional[RichConsole] = None,
|
29
|
+
main_callback_parameters: Optional[list[inspect.Parameter]] = None,
|
30
|
+
**kwargs):
|
31
|
+
|
32
|
+
# set default
|
33
|
+
if settings is None:
|
34
|
+
settings = TyperSettings()
|
35
|
+
if type(title) is Default:
|
36
|
+
title = settings.branding_title
|
37
|
+
if title is None:
|
38
|
+
title = "Typer"
|
39
|
+
if type(description) is Default:
|
40
|
+
description = settings.branding_description
|
41
|
+
if type(version) is Default:
|
42
|
+
version = settings.branding_version
|
43
|
+
if version is None:
|
44
|
+
version = "0.1.0"
|
45
|
+
if type(author) is Default:
|
46
|
+
author = settings.branding_author
|
47
|
+
if type(author_email) is Default:
|
48
|
+
author_email = settings.branding_author_email
|
49
|
+
if type(license) is Default:
|
50
|
+
license = settings.branding_license
|
51
|
+
if type(license_url) is Default:
|
52
|
+
license_url = settings.branding_license_url
|
53
|
+
if type(terms_of_service) is Default:
|
54
|
+
terms_of_service = settings.branding_terms_of_service
|
55
|
+
if type(info_enabled) is Default:
|
56
|
+
info_enabled = settings.cli_info_enabled
|
57
|
+
if type(version_enabled) is Default:
|
58
|
+
version_enabled = settings.cli_version_enabled
|
59
|
+
if type(name) is Default:
|
60
|
+
name = settings.cli_name
|
61
|
+
if type(name) is Default:
|
62
|
+
name = title
|
63
|
+
if type(help) is Default:
|
64
|
+
help = settings.cli_help
|
65
|
+
if type(help) is Default:
|
66
|
+
help = description
|
67
|
+
if console is None:
|
68
|
+
console = RichConsole(settings=settings)
|
69
|
+
if main_callback_parameters is None:
|
70
|
+
main_callback_parameters = []
|
71
|
+
|
72
|
+
super().__init__(name=name, help=help, **kwargs)
|
73
|
+
|
74
|
+
# set attrs
|
75
|
+
self.title = title
|
76
|
+
self.description = description
|
77
|
+
self.version = version
|
78
|
+
self.author = author
|
79
|
+
self.author_email = author_email
|
80
|
+
self.license = license
|
81
|
+
self.license_url = license_url
|
82
|
+
self.terms_of_service = terms_of_service
|
83
|
+
self.info_enabled = info_enabled
|
84
|
+
self.version_enabled = version_enabled
|
85
|
+
self.name = name
|
86
|
+
self.help = help
|
87
|
+
self.console = console
|
88
|
+
|
89
|
+
# add info command parameter to main_callback_parameters
|
90
|
+
if info_enabled:
|
91
|
+
def info_callback(value: bool) -> None:
|
92
|
+
if not value:
|
93
|
+
return
|
94
|
+
code = self.info_command()
|
95
|
+
if code is None:
|
96
|
+
code = 0
|
97
|
+
raise Exit(code=code)
|
98
|
+
|
99
|
+
main_callback_parameters.append(inspect.Parameter(name="info",
|
100
|
+
kind=inspect.Parameter.KEYWORD_ONLY,
|
101
|
+
default=False,
|
102
|
+
annotation=Annotated[Optional[bool], Option("--info",
|
103
|
+
help="Show information of the application.",
|
104
|
+
callback=info_callback)]))
|
105
|
+
|
106
|
+
# add version command parameter to main_callback_parameters
|
107
|
+
if version_enabled:
|
108
|
+
def version_callback(value: bool):
|
109
|
+
if not value:
|
110
|
+
return
|
111
|
+
code = self.version_command()
|
112
|
+
if code is None:
|
113
|
+
code = 0
|
114
|
+
raise Exit(code=code)
|
115
|
+
|
116
|
+
main_callback_parameters.append(inspect.Parameter(name="version",
|
117
|
+
kind=inspect.Parameter.KEYWORD_ONLY,
|
118
|
+
default=False,
|
119
|
+
annotation=Annotated[Optional[bool], Option("-v",
|
120
|
+
"--version",
|
121
|
+
help="Show version of the application.",
|
122
|
+
callback=version_callback)]))
|
123
|
+
|
124
|
+
# backup main callback
|
125
|
+
orig_main_callback = self.main_callback
|
126
|
+
|
127
|
+
def main_callback(*a, **kw):
|
128
|
+
orig_main_callback(*a, **kw)
|
129
|
+
|
130
|
+
# update signature
|
131
|
+
main_callback.__signature__ = inspect.signature(self.main_callback).replace(parameters=main_callback_parameters)
|
132
|
+
|
133
|
+
# overwrite the main callback
|
134
|
+
self.main_callback = main_callback
|
135
|
+
|
136
|
+
# register the main callback
|
137
|
+
self.callback()(self.main_callback)
|
138
|
+
|
139
|
+
def main_callback(self, *args, **kwargs):
|
140
|
+
...
|
141
|
+
|
142
|
+
def info_command(self) -> Optional[int]:
|
143
|
+
card_body = [text2art(self.title)]
|
144
|
+
second_section = ""
|
145
|
+
if self.description is not None:
|
146
|
+
second_section += f"{self.description}"
|
147
|
+
if self.author is not None:
|
148
|
+
if second_section != "":
|
149
|
+
second_section += "\n"
|
150
|
+
second_section += f"by {self.author}"
|
151
|
+
if self.author_email is not None:
|
152
|
+
second_section += f" ({self.author_email})"
|
153
|
+
if second_section != "":
|
154
|
+
second_section += "\n"
|
155
|
+
second_section += f"Version: v{self.version}"
|
156
|
+
if self.license is not None:
|
157
|
+
second_section += f"\nLicense: {self.license}"
|
158
|
+
if self.license_url is not None:
|
159
|
+
second_section += f" - {self.license_url}"
|
160
|
+
if self.terms_of_service is not None:
|
161
|
+
second_section += f"\nTerms of Service: {self.terms_of_service}"
|
162
|
+
card_body.append(second_section)
|
163
|
+
|
164
|
+
self.console.card(*card_body,
|
165
|
+
padding_left=1,
|
166
|
+
padding_right=1,
|
167
|
+
border_style="double_line",
|
168
|
+
color="white",
|
169
|
+
border_color="blue")
|
170
|
+
|
171
|
+
def version_command(self) -> Optional[int]:
|
172
|
+
self.console.print(f"{self.title} v[cyan]{self.version}[/cyan]")
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from typing import Union
|
2
|
+
|
3
|
+
from pydantic import Field
|
4
|
+
|
5
|
+
from wiederverwendbar.branding.settings import BrandingSettings
|
6
|
+
from wiederverwendbar.default import Default
|
7
|
+
from wiederverwendbar.rich.settings import RichConsoleSettings
|
8
|
+
|
9
|
+
|
10
|
+
class TyperSettings(RichConsoleSettings, BrandingSettings):
|
11
|
+
cli_name: Union[None, Default, str] = Field(default=Default(), title="CLI Name", description="The name of the CLI.")
|
12
|
+
cli_help: Union[None, Default, str] = Field(default=Default(), title="CLI Help", description="The help of the CLI.")
|
13
|
+
cli_info_enabled: bool = Field(default=True, title="Info Command", description="Enable the info command.")
|
14
|
+
cli_version_enabled: bool = Field(default=True, title="Version Command", description="Enable the version command.")
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: wiederverwendbar
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0
|
4
4
|
Summary: A collection of scripts, classes and tools they are \"wiederverwendbar\".
|
5
5
|
Author-Email: Julius Koenig <info@bastelquartier.de>
|
6
6
|
License: GPL-3.0
|
7
7
|
Requires-Python: >=3.9
|
8
|
-
Requires-Dist: pydantic>=2.11.
|
8
|
+
Requires-Dist: pydantic>=2.11.7
|
9
9
|
Requires-Dist: pydantic-settings>=2.9.1
|
10
10
|
Requires-Dist: devtools>=0.12.2
|
11
11
|
Provides-Extra: full
|
@@ -13,28 +13,31 @@ Requires-Dist: rich>=14.0.0; extra == "full"
|
|
13
13
|
Requires-Dist: typer>=0.16.0; extra == "full"
|
14
14
|
Requires-Dist: pythonping>=1.1.4; extra == "full"
|
15
15
|
Requires-Dist: mongoengine>=0.29.1; extra == "full"
|
16
|
-
Requires-Dist: nicegui>=2.
|
16
|
+
Requires-Dist: nicegui>=2.20.0; extra == "full"
|
17
17
|
Requires-Dist: uvicorn>=0.34.3; extra == "full"
|
18
|
-
Requires-Dist: fastapi>=0.115.
|
18
|
+
Requires-Dist: fastapi>=0.115.13; extra == "full"
|
19
19
|
Requires-Dist: starlette-admin[i18n]>=0.15.1; extra == "full"
|
20
20
|
Requires-Dist: pillow>=11.2.1; extra == "full"
|
21
21
|
Requires-Dist: blinker>=1.9.0; extra == "full"
|
22
22
|
Requires-Dist: kombu>=5.5.4; extra == "full"
|
23
23
|
Requires-Dist: nest-asyncio>=1.6.0; extra == "full"
|
24
24
|
Requires-Dist: sqlalchemy>=2.0.41; extra == "full"
|
25
|
+
Requires-Dist: art>=6.5; extra == "full"
|
25
26
|
Provides-Extra: rich
|
26
27
|
Requires-Dist: rich>=14.0.0; extra == "rich"
|
27
28
|
Provides-Extra: typer
|
28
29
|
Requires-Dist: typer>=0.16.0; extra == "typer"
|
30
|
+
Requires-Dist: art>=6.5; extra == "typer"
|
31
|
+
Requires-Dist: rich>=14.0.0; extra == "typer"
|
29
32
|
Provides-Extra: mongoengine
|
30
33
|
Requires-Dist: mongoengine>=0.29.1; extra == "mongoengine"
|
31
34
|
Requires-Dist: blinker>=1.9.0; extra == "mongoengine"
|
32
35
|
Provides-Extra: uvicorn
|
33
36
|
Requires-Dist: uvicorn>=0.34.3; extra == "uvicorn"
|
34
37
|
Provides-Extra: fastapi
|
35
|
-
Requires-Dist: fastapi>=0.115.
|
38
|
+
Requires-Dist: fastapi>=0.115.13; extra == "fastapi"
|
36
39
|
Provides-Extra: nicegui
|
37
|
-
Requires-Dist: nicegui>=2.
|
40
|
+
Requires-Dist: nicegui>=2.20.0; extra == "nicegui"
|
38
41
|
Provides-Extra: starlette-admin
|
39
42
|
Requires-Dist: starlette-admin[i18n]>=0.15.1; extra == "starlette-admin"
|
40
43
|
Requires-Dist: pillow>=11.2.1; extra == "starlette-admin"
|
@@ -1,41 +1,19 @@
|
|
1
|
-
wiederverwendbar-0.
|
2
|
-
wiederverwendbar-0.
|
3
|
-
wiederverwendbar-0.
|
4
|
-
wiederverwendbar/__init__.py,sha256=
|
1
|
+
wiederverwendbar-0.9.0.dist-info/METADATA,sha256=mn3kjQ5KNme6V9DK74J_SccF9_SXhz0w9Pl8SHlz1UM,2141
|
2
|
+
wiederverwendbar-0.9.0.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
wiederverwendbar-0.9.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
wiederverwendbar/__init__.py,sha256=UIg7Egu5ppyFjSU6NnfKZ-i-bWwXo5Lgzq_y0ot7hno,376
|
5
5
|
wiederverwendbar/before_after_wrap.py,sha256=8rjyRrDpwbzrsKkY7vbIgtitgLjlF8Lwx8YNvcJWwgY,10425
|
6
|
-
wiederverwendbar/
|
7
|
-
wiederverwendbar/
|
8
|
-
wiederverwendbar/
|
9
|
-
wiederverwendbar/
|
10
|
-
wiederverwendbar/
|
11
|
-
wiederverwendbar/
|
12
|
-
wiederverwendbar/
|
13
|
-
wiederverwendbar/
|
14
|
-
wiederverwendbar/
|
15
|
-
wiederverwendbar/
|
16
|
-
wiederverwendbar/
|
17
|
-
wiederverwendbar/examples/mongoengine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
wiederverwendbar/examples/mongoengine/automatic_reference.py,sha256=pgtQ1j8gJbrOCXtKj2lnZvGfbIpffeyKHJkxP0qFFv8,1149
|
19
|
-
wiederverwendbar/examples/mongoengine/db.py,sha256=0DfB6UFKXedcbbf2Ft7WsjV18y4lpUfVuZvXn3kngAU,306
|
20
|
-
wiederverwendbar/examples/mongoengine/log_streamer.py,sha256=aO7KiGO0fx4Ix4SPAOU2ltjZNgNcx1EOx8IeAwgRR34,304
|
21
|
-
wiederverwendbar/examples/mongoengine/logger.py,sha256=hJvwulY_Qivzc8up332vVxRw73iDJJSpbr0_JrYet6g,640
|
22
|
-
wiederverwendbar/examples/post_init.py,sha256=hrj3idlYknWEzK0ijy6jiRkryjLYjLJiGkFForGk6q4,774
|
23
|
-
wiederverwendbar/examples/route.py,sha256=hbV3lLcqDtusBDjv11Aw5aBbBFAakFTkoMXg1hQAfeY,423
|
24
|
-
wiederverwendbar/examples/singletons.py,sha256=O5sDsEpg_hzLIQYEIHKL-HMyRHowL2CcSkUryy-vI-k,1101
|
25
|
-
wiederverwendbar/examples/sqlalchemy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
-
wiederverwendbar/examples/sqlalchemy/db.py,sha256=OkaxZ2594zcu00aHEdSgJTTvfuZnwaKb00yXt_1R8YU,3061
|
27
|
-
wiederverwendbar/examples/starlette_admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
|
-
wiederverwendbar/examples/starlette_admin/action_log.py,sha256=IbeLsB_Kq2nQFBCoKScJzhotLElFfGD22h5SXQoxQ9Q,4439
|
29
|
-
wiederverwendbar/examples/starlette_admin/action_log_file_download.py,sha256=Jv7fCxqMaPpO-4i1ra09ya9KxlpJgsjdplNLD99OY0M,3249
|
30
|
-
wiederverwendbar/examples/starlette_admin/action_log_form.py,sha256=C-xO4vLag62_JDFuEtZj7K6Vvt3dMxNS8Pl5NVwY2ZU,5599
|
31
|
-
wiederverwendbar/examples/starlette_admin/action_log_thread.py,sha256=ePetz-Dt3qgPjhHTNNn6MqD8Y275LJrX8A7uYhEAxyM,7277
|
32
|
-
wiederverwendbar/examples/starlette_admin/automatic_reference_admin.py,sha256=ZA_5LtXmpGb_q4kiyIJTwqNPqY-lQldwPF0hvR072A4,1200
|
33
|
-
wiederverwendbar/examples/starlette_admin/generic_embedded_document_field.py,sha256=TH1em2_JbvjXQdCyn9ln_Gdsl5GAadMTctoDgpT-Xr8,2058
|
34
|
-
wiederverwendbar/examples/starlette_admin/multi_path_admin.py,sha256=2Qkpyg1Yi0EGiGWfI_MFsVoytP0y77LHgp3u_jjaVPw,707
|
35
|
-
wiederverwendbar/examples/task_manager.py,sha256=ThNPMpt5zuq-9JsX2lS0jKQtBYCNWOEUpo4NCFBZIx8,1402
|
36
|
-
wiederverwendbar/examples/test_file.py,sha256=ieHkacZemgWeDKfzYzwVbRcR9iqCqpICzgCIAscQQPY,379
|
37
|
-
wiederverwendbar/examples/typer_resolve_defaults.py,sha256=M1FdXEkvP9_m914LNknbEcDHdg0ehTSOHozGDap9UUA,336
|
38
|
-
wiederverwendbar/examples/uvicorn_server.py,sha256=0z1rAePpaRcJL3f90_H9I8m7YMtVokpdvS--rVy_GFE,827
|
6
|
+
wiederverwendbar/branding/__init__.py,sha256=IWUQkLQwp22HyTs6Zh28mg8YKkv47bowYDkXl_kOtpI,66
|
7
|
+
wiederverwendbar/branding/settings.py,sha256=myJqzTzrC6iWNq5b-dXNwHl-9z-0ZWlf-tRT2CeH0yQ,4486
|
8
|
+
wiederverwendbar/console/__init__.py,sha256=hhs9LhQrAvnpMSomnHj5GhYblHVptK3o2CVXypP08Rw,177
|
9
|
+
wiederverwendbar/console/console.py,sha256=0BKgcALRyCZelqJaDKJfLbmHI6YY7DTUXJJ4brGSVuw,8537
|
10
|
+
wiederverwendbar/console/out_files.py,sha256=bC36OdEZteH-lMoPW9JbDPdsrYLABffLq-9wVscamZ4,411
|
11
|
+
wiederverwendbar/console/settings.py,sha256=nvsK6vRYu5-1ojYJSN1NImRTNWfZR2RE41sOIX-Loo8,520
|
12
|
+
wiederverwendbar/default.py,sha256=AKjlNXYbQUiLOPCcje4XLpeJPdeRbJ4YGDwW9QQ0E54,93
|
13
|
+
wiederverwendbar/fastapi/__init__.py,sha256=wW_91YoGhZDCoYuct44sFgOYLeKsuKqqfOt1IFhXuyY,175
|
14
|
+
wiederverwendbar/fastapi/app.py,sha256=sPgn1oVIr8XV4WTusHCyD__h3u8ICRRfITQJD8IpZvo,18630
|
15
|
+
wiederverwendbar/fastapi/dependencies.py,sha256=REVIscmYu4pTD9DsoCnMRhmTHGWG9J9d-xBSKyLL3t4,323
|
16
|
+
wiederverwendbar/fastapi/settings.py,sha256=bafvekI9cJgBPi8tG9DL2MEcsfT86xuzMyyhvgE19zk,3596
|
39
17
|
wiederverwendbar/functions/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
40
18
|
wiederverwendbar/functions/admin.py,sha256=5O0CV0Nwg6Blv9_RIPDRAoal1SB3mOa1jne9IAVlTdM,1416
|
41
19
|
wiederverwendbar/functions/animal_name_generator.py,sha256=74-blGU3oxHpWB7pRtD5GerFaaluiTRl_gUe2uu3qW0,3707
|
@@ -47,24 +25,25 @@ wiederverwendbar/functions/download_file.py,sha256=vNpaNpQ_YL9-D81Leey_RYv_OcPsU
|
|
47
25
|
wiederverwendbar/functions/eval.py,sha256=zINxAfZ2mlNC4m36S2CQT2H4oTHyfBb-MJdZdgMfS0k,4537
|
48
26
|
wiederverwendbar/functions/find_class_method.py,sha256=QAE66bf75gkRrwhiD5spnNG-cX1trdQh6pQhNir79bc,470
|
49
27
|
wiederverwendbar/functions/get_pretty_str.py,sha256=pM4itXdiozjD3PQblAxhhkOLO7TY3pDYnmiqlZVJnWw,205
|
28
|
+
wiederverwendbar/functions/is_coroutine_function.py,sha256=a0ksY9Qoy4xVFVJLHH2ZtGTQNPMme90xC0z0BJoacvg,505
|
50
29
|
wiederverwendbar/functions/run_command.py,sha256=7j9cE0mqNVmu0MOojw7plEMttYZqYMsUgc8kOYS2v5I,1902
|
51
30
|
wiederverwendbar/functions/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
31
|
wiederverwendbar/functions/security/hashed_password.py,sha256=8qNOzvf4g7Z7YHDfdq6YSq6ZpYkseDogbcU4sxi3GGQ,3470
|
53
32
|
wiederverwendbar/functions/test_file.py,sha256=63mzXhLXibYTR0CRbSQ3nzDD0qOvVRR6yC-xIIkdyf4,839
|
54
33
|
wiederverwendbar/functions/wait_ping.py,sha256=07ZT1yU1JWFDdSzEC7bzGRYR6iL65BKZfDtf8EIXWjQ,1193
|
55
|
-
wiederverwendbar/
|
34
|
+
wiederverwendbar/inspect.py,sha256=ZuOiQY07sVtTuZmU32F-WspUp3Fvd8DHomAFquMHY2Y,820
|
35
|
+
wiederverwendbar/logger/__init__.py,sha256=PpHGf3PAhaXcGYG18JisWm2EuqJX-askuk9WGlgdceQ,677
|
56
36
|
wiederverwendbar/logger/context.py,sha256=k8rVgrd0FYnoaaPZ4lIHRXRh8OjPElOtv-HRc3moDk8,13408
|
57
37
|
wiederverwendbar/logger/file_modes.py,sha256=9QqVkkF9w8NX44tkn2KeZafLxbHRVWklxClB6iuSuTs,108
|
58
38
|
wiederverwendbar/logger/handlers/__init__.py,sha256=68JdpQQnxzOudLzuCfiQjibSZ8QeRlnVd-YzfGnq9w4,337
|
59
|
-
wiederverwendbar/logger/handlers/rich_console_handler.py,sha256=
|
60
|
-
wiederverwendbar/logger/handlers/stream_console_handler.py,sha256
|
39
|
+
wiederverwendbar/logger/handlers/rich_console_handler.py,sha256=0L97lkWpln9ZRH5ltdfhtjIZgpyesGh5vXga_DMNTXM,780
|
40
|
+
wiederverwendbar/logger/handlers/stream_console_handler.py,sha256=uaUFGKn_hyZRHfKWka6p7JjVUahXcI0pf7dy322PbV0,265
|
61
41
|
wiederverwendbar/logger/handlers/tar_rotating_file_handler.py,sha256=Ci2f4Mvy9f1DacNJiA_P0loWwI4y4oEW9fP0D1iMd8w,2500
|
62
42
|
wiederverwendbar/logger/helper.py,sha256=bI3Qi6aCugmmRkuB5dJGSkKxpr-0bX8TaZtwdk6IS4c,1292
|
63
|
-
wiederverwendbar/logger/log_levels.py,sha256=
|
43
|
+
wiederverwendbar/logger/log_levels.py,sha256=UMySiDUyOmM3mjJwtT3dXs2Gs5oTIDhT-bOsJh3ZS9Y,320
|
64
44
|
wiederverwendbar/logger/logger.py,sha256=yb-0aD3_mYHdwC-xnbg3oPegM_q4H0S-q14mlVedfVA,2860
|
65
|
-
wiederverwendbar/logger/settings.py,sha256=
|
45
|
+
wiederverwendbar/logger/settings.py,sha256=ALuTyFIyCaA3E3ifD9F-JUavkEZ5udQrUQN0sOgSb1Y,5739
|
66
46
|
wiederverwendbar/logger/singleton.py,sha256=3FWKLSIF7aGOUR2TlBHfO2BHFwYvzGa5hrtsD6Im2GE,3260
|
67
|
-
wiederverwendbar/logger/terminal_out_files.py,sha256=2Ima9h5ue7-8uFtrY9n3W6hQUHy6l8HFD_-ohFj9I3A,146
|
68
47
|
wiederverwendbar/mongoengine/__init__.py,sha256=f-yjDKWf3VoghwCf7kqZSRWDqRlHZ5Ca6iz8_m6bmDQ,1277
|
69
48
|
wiederverwendbar/mongoengine/automatic_reference.py,sha256=pbgqYL9zN6B_dO0mhA1YTWM8MCqoB2n7urdvt82V3XA,15534
|
70
49
|
wiederverwendbar/mongoengine/backup.py,sha256=HH-JEYMElkeESFvucKwxyXCuupEGXoXkYiLaWr_HWGE,4635
|
@@ -94,6 +73,9 @@ wiederverwendbar/pydantic/printable_settings.py,sha256=CSN8n1NUnviOMc6wgnvIdcQlb
|
|
94
73
|
wiederverwendbar/pydantic/security/__init__.py,sha256=l-DRf-vueyP-M4pePTzQgCYZcBMb_0Fg5flwN-0dBWc,83
|
95
74
|
wiederverwendbar/pydantic/security/hashed_password.py,sha256=h3gk048_wcXu4euGy24Mpos01Fs5E78LXcLLOHD3qxg,798
|
96
75
|
wiederverwendbar/pydantic/singleton.py,sha256=4YMBcKiTik2KmuN97CUCmy_ldhfyeDzrsUMsdB_23Rs,270
|
76
|
+
wiederverwendbar/rich/__init__.py,sha256=CR1RnF7UotyaZ0b44aIEOMeiScjLy92FsIX3icLq6LU,121
|
77
|
+
wiederverwendbar/rich/console.py,sha256=EWaSx9IU1BLAEXAiCPvhqQnF8TxshW3kfzJhEx5IgG8,9451
|
78
|
+
wiederverwendbar/rich/settings.py,sha256=eqIfHtxF5znJj1vUepqyyR94Xw_8ebtBNW_xvDHWGT8,2523
|
97
79
|
wiederverwendbar/route.py,sha256=moYlZ5IvV_uDroSggxe80-sR3_nlNsl9Bp69CcCfK8Y,12061
|
98
80
|
wiederverwendbar/singleton.py,sha256=6QqeQpzx4UhBZnvto5_yUs7hpmzt_-dyE169RuwsTa8,6866
|
99
81
|
wiederverwendbar/sqlalchemy/__init__.py,sha256=gkt99fc9wIxaSjrl1xNhmPLrlJNZhrY-sJ5yIezREGM,888
|
@@ -163,10 +145,12 @@ wiederverwendbar/task_manger/task_manager.py,sha256=FuB0Lf2ff4KaVtPp7G585uF7GjjM
|
|
163
145
|
wiederverwendbar/task_manger/trigger.py,sha256=biTQv3_S7d14CkPXKjDQxL6XbTet7-PVRwofsCBs3Wc,9906
|
164
146
|
wiederverwendbar/threading/__init__.py,sha256=jFeP8mQws_JVwxL8W1fCsWPUcFqO-l39yQ8d9P3AqtQ,508
|
165
147
|
wiederverwendbar/threading/extended_thread.py,sha256=CJi2fmpHBZD9jo5B8_85Ax8jo1pM5n9cjEVuG6Guxg8,23409
|
166
|
-
wiederverwendbar/typer/__init__.py,sha256=
|
148
|
+
wiederverwendbar/typer/__init__.py,sha256=sOFS8tcI_eeICm7V5G-ZMAw5rFs6wl7UnHnLkOzso1U,190
|
149
|
+
wiederverwendbar/typer/app.py,sha256=1taEZEeScemjd0nOybBBnHMJboRCUmC-vVV7AE_27Gw,7472
|
150
|
+
wiederverwendbar/typer/settings.py,sha256=uJc7WeAoFV1Aa7vSpfms_CXRYicSn3M2MZ6ZpIbd0qQ,761
|
167
151
|
wiederverwendbar/typer/typer_resolve_defaults.py,sha256=2KD09rxKaur2TbJ3BCcLxbrcjhRgiFE8pskzN0lqDiE,1193
|
168
152
|
wiederverwendbar/uvicorn/__init__.py,sha256=9F7gT-8QyxS41xWKEIHMLUBV9ZTBKZJj8tHPqhMzoHA,126
|
169
153
|
wiederverwendbar/uvicorn/server.py,sha256=04WpB8AUtVkYhoS6qsBVJHOtTNkISQVg_mLVtYmK-1Y,5657
|
170
154
|
wiederverwendbar/uvicorn/settings.py,sha256=IAjlpWR-KH7098jIgH_t46yG17YPbH8MoEmMdn0hgNo,2217
|
171
155
|
wiederverwendbar/warnings.py,sha256=6P1wn-OkrDCo5zg_hL28nt5b9w4ZXo4qXwlpW9B_QWI,110
|
172
|
-
wiederverwendbar-0.
|
156
|
+
wiederverwendbar-0.9.0.dist-info/RECORD,,
|
File without changes
|