oe-python-template 0.17.0__py3-none-any.whl → 0.17.3__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.
- oe_python_template/system/_gui.py +11 -5
- oe_python_template/system/_service.py +8 -4
- oe_python_template/utils/_gui.py +1 -1
- oe_python_template/utils/_process.py +2 -1
- {oe_python_template-0.17.0.dist-info → oe_python_template-0.17.3.dist-info}/METADATA +1 -1
- {oe_python_template-0.17.0.dist-info → oe_python_template-0.17.3.dist-info}/RECORD +9 -9
- {oe_python_template-0.17.0.dist-info → oe_python_template-0.17.3.dist-info}/WHEEL +0 -0
- {oe_python_template-0.17.0.dist-info → oe_python_template-0.17.3.dist-info}/entry_points.txt +0 -0
- {oe_python_template-0.17.0.dist-info → oe_python_template-0.17.3.dist-info}/licenses/LICENSE +0 -0
@@ -7,14 +7,20 @@ from ._service import Service
|
|
7
7
|
class PageBuilder(BasePageBuilder):
|
8
8
|
@staticmethod
|
9
9
|
def register_pages() -> None:
|
10
|
-
from nicegui import ui # noqa: PLC0415
|
10
|
+
from nicegui import run, ui # noqa: PLC0415
|
11
11
|
|
12
12
|
@ui.page("/info")
|
13
|
-
def page_info() -> None:
|
13
|
+
async def page_info() -> None:
|
14
14
|
"""Homepage of GUI."""
|
15
15
|
ui.label(f"{__project_name__} v{__version__}").mark("LABEL_VERSION")
|
16
|
-
ui.
|
17
|
-
|
16
|
+
spinner = ui.spinner("dots", size="lg", color="red")
|
17
|
+
properties = {
|
18
|
+
"content": {"json": "Loading ..."},
|
18
19
|
"readOnly": True,
|
19
|
-
}
|
20
|
+
}
|
21
|
+
editor = ui.json_editor(properties).mark("JSON_EDITOR_INFO")
|
20
22
|
ui.link("Home", "/").mark("LINK_HOME")
|
23
|
+
info = await run.cpu_bound(Service().info, True, True)
|
24
|
+
properties["content"] = {"json": info}
|
25
|
+
editor.update()
|
26
|
+
spinner.delete()
|
@@ -31,6 +31,10 @@ from ._settings import Settings
|
|
31
31
|
|
32
32
|
log = get_logger(__name__)
|
33
33
|
|
34
|
+
# Note: There is multiple measurements and network calls
|
35
|
+
MEASURE_INTERVAL_SECONDS = 5
|
36
|
+
NETWORK_TIMEOUT = 5
|
37
|
+
|
34
38
|
|
35
39
|
class RuntimeDict(TypedDict, total=False):
|
36
40
|
"""Type for runtime information dictionary."""
|
@@ -103,7 +107,7 @@ class Service(BaseService):
|
|
103
107
|
return token == self._settings.token.get_secret_value()
|
104
108
|
|
105
109
|
@staticmethod
|
106
|
-
def _get_public_ipv4(timeout: int =
|
110
|
+
def _get_public_ipv4(timeout: int = NETWORK_TIMEOUT) -> str | None:
|
107
111
|
"""Get the public IPv4 address of the system.
|
108
112
|
|
109
113
|
Args:
|
@@ -151,14 +155,14 @@ class Service(BaseService):
|
|
151
155
|
Returns:
|
152
156
|
dict[str, Any]: Service configuration.
|
153
157
|
"""
|
154
|
-
from uptime import boottime, uptime # noqa: PLC0415
|
155
158
|
import psutil # noqa: PLC0415
|
159
|
+
from uptime import boottime, uptime # noqa: PLC0415
|
156
160
|
|
157
161
|
bootdatetime = boottime()
|
158
162
|
vmem = psutil.virtual_memory()
|
159
163
|
swap = psutil.swap_memory()
|
160
|
-
cpu_percent = psutil.cpu_percent(interval=
|
161
|
-
cpu_times_percent = psutil.cpu_times_percent(interval=
|
164
|
+
cpu_percent = psutil.cpu_percent(interval=MEASURE_INTERVAL_SECONDS)
|
165
|
+
cpu_times_percent = psutil.cpu_times_percent(interval=MEASURE_INTERVAL_SECONDS)
|
162
166
|
|
163
167
|
rtn: InfoDict = {
|
164
168
|
"package": {
|
oe_python_template/utils/_gui.py
CHANGED
@@ -163,7 +163,7 @@ class GUILocalFilePicker:
|
|
163
163
|
self.drives_toggle = ui.toggle(drives, value=drives[0], on_change=self.update_drive)
|
164
164
|
|
165
165
|
def update_drive(self) -> None:
|
166
|
-
self.path = Path(self.drives_toggle.value).expanduser()
|
166
|
+
self.path = Path(str(self.drives_toggle.value)).expanduser()
|
167
167
|
self.update_grid()
|
168
168
|
|
169
169
|
def update_grid(self) -> None:
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
from pathlib import Path
|
4
4
|
|
5
|
-
import psutil
|
6
5
|
from pydantic import BaseModel
|
7
6
|
|
8
7
|
|
@@ -28,6 +27,8 @@ def get_process_info() -> ProcessInfo:
|
|
28
27
|
Returns:
|
29
28
|
ProcessInfo: Object containing process information.
|
30
29
|
"""
|
30
|
+
import psutil # noqa: PLC0415
|
31
|
+
|
31
32
|
current_process = psutil.Process()
|
32
33
|
parent = current_process.parent()
|
33
34
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: oe-python-template
|
3
|
-
Version: 0.17.
|
3
|
+
Version: 0.17.3
|
4
4
|
Summary: 🧠 Copier template to scaffold Python projects compliant with best practices and modern tooling.
|
5
5
|
Project-URL: Homepage, https://oe-python-template.readthedocs.io/en/latest/
|
6
6
|
Project-URL: Documentation, https://oe-python-template.readthedocs.io/en/latest/
|
@@ -13,8 +13,8 @@ oe_python_template/hello/_settings.py,sha256=_85PIdq8UuS4orCZ0qFJ22RTQTooOTB0USR
|
|
13
13
|
oe_python_template/system/__init__.py,sha256=7e2z8HATzy3dAIBXy5PM9rlCC7Rbu8m8NapROdrf3Wk,624
|
14
14
|
oe_python_template/system/_api.py,sha256=pBBCL1gXM7W5dgJqBLKuNFWES0pQF8mbUgQ7H7oHwh8,3714
|
15
15
|
oe_python_template/system/_cli.py,sha256=fVO_TSIyiaMJ2ACeQ4gPy4QQZjmeBVnsxxsViuNGe8I,6990
|
16
|
-
oe_python_template/system/_gui.py,sha256=
|
17
|
-
oe_python_template/system/_service.py,sha256=
|
16
|
+
oe_python_template/system/_gui.py,sha256=MG2nyHZoqD1E4TIrmvBnGwu8-hgKpFt1kKd2aF10FBI,961
|
17
|
+
oe_python_template/system/_service.py,sha256=VlQrRHLq2HUGmYyfHoiiIuvfMPemo94ZwkUsd0VLeTY,10443
|
18
18
|
oe_python_template/system/_settings.py,sha256=MwMAJYifJ6jGImeSh4e9shmIXmiUSuQGHXz_Ts0mSdk,901
|
19
19
|
oe_python_template/utils/__init__.py,sha256=oM8v1ozMOeBQG-EbBtEGbnuGk52mYNDAmNoR7vNQ7MY,2050
|
20
20
|
oe_python_template/utils/_api.py,sha256=GSI-HPtSdTFv0qP5aTDPa2WS3ewVa1slusG6dvxSu0Y,2474
|
@@ -22,19 +22,19 @@ oe_python_template/utils/_cli.py,sha256=J_mFtXZ1gGeovGrE5i3wlokTOBfiTTKEz5magiRP
|
|
22
22
|
oe_python_template/utils/_console.py,sha256=u0-utcdRmVu4rabrYUyNOx8yPxLhxB3E92m22kSCwPQ,293
|
23
23
|
oe_python_template/utils/_constants.py,sha256=WfXarYsOP1z3iv-DNEw7FNBekLXEz2rHYICAaqdoQd8,3301
|
24
24
|
oe_python_template/utils/_di.py,sha256=J1-f6xtbnR88VfRAsRMl5m6eqt-Lf3c7ABSJOxNzlvU,2399
|
25
|
-
oe_python_template/utils/_gui.py,sha256=
|
25
|
+
oe_python_template/utils/_gui.py,sha256=e3fYHNJQNIMbV74zu27Wp_fog3QqbIDukqRWUE_f17Y,7754
|
26
26
|
oe_python_template/utils/_health.py,sha256=35QOWe2r5InrEpGtuVMym9dI5aRHS0HWf4BHBRAUIj0,4102
|
27
27
|
oe_python_template/utils/_log.py,sha256=t6CAlSvnwZhls0cPWupodXWGGjNlMHF8T9W69ngIV-E,5156
|
28
28
|
oe_python_template/utils/_logfire.py,sha256=wZYNVowQx7kh3XJoJ59FjUKdrta7tp6cXOJRUT6lDU8,2128
|
29
29
|
oe_python_template/utils/_notebook.py,sha256=IZOQTRKVV5htwXZIpZIZbAAOo86NK1L8vYkg1o7HW1Q,2114
|
30
|
-
oe_python_template/utils/_process.py,sha256=
|
30
|
+
oe_python_template/utils/_process.py,sha256=m6RQZrr8phMjwmtQfXXra6FakB6Cn4_2wP0YyEfjU6M,963
|
31
31
|
oe_python_template/utils/_sentry.py,sha256=6SZknbGBpdZHYUpF-11qk6UYBM-c79U8D9sF4517kdU,6369
|
32
32
|
oe_python_template/utils/_service.py,sha256=atHAejvBucKXjzhsMSdOBBFa7rRD74zcV70Pp0pl0Tg,1038
|
33
33
|
oe_python_template/utils/_settings.py,sha256=owFoaHEzJnVD3EVyOWF4rfIY7g6eLnU6rN0m4VHhCbA,2464
|
34
34
|
oe_python_template/utils/boot.py,sha256=Qgq1sjT8d3fcfibnMyx5CVUJ_KKXgFI3ozZUIJbhh4I,2921
|
35
35
|
oe_python_template/utils/.vendored/bottle.py,sha256=kZAZmh3nRzCUf-9IKGpv0yqlMciZMA_DNaaMDdcQmt0,175437
|
36
|
-
oe_python_template-0.17.
|
37
|
-
oe_python_template-0.17.
|
38
|
-
oe_python_template-0.17.
|
39
|
-
oe_python_template-0.17.
|
40
|
-
oe_python_template-0.17.
|
36
|
+
oe_python_template-0.17.3.dist-info/METADATA,sha256=5ISa289YKduSr-62l64WIBDS6vYijotY-qM7NtUjEkw,34606
|
37
|
+
oe_python_template-0.17.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
38
|
+
oe_python_template-0.17.3.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
|
39
|
+
oe_python_template-0.17.3.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
|
40
|
+
oe_python_template-0.17.3.dist-info/RECORD,,
|
File without changes
|
{oe_python_template-0.17.0.dist-info → oe_python_template-0.17.3.dist-info}/entry_points.txt
RENAMED
File without changes
|
{oe_python_template-0.17.0.dist-info → oe_python_template-0.17.3.dist-info}/licenses/LICENSE
RENAMED
File without changes
|