oe-python-template 0.17.0__py3-none-any.whl → 0.17.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.
@@ -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.json_editor({
17
- "content": {"json": Service().info(True, True)},
16
+ spinner = ui.spinner("dots", size="lg", color="red")
17
+ properties = {
18
+ "content": {"json": "Loading ..."},
18
19
  "readOnly": True,
19
- }).mark("JSON_EDITOR_INFO")
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 = 5) -> str | None:
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=2)
161
- cpu_times_percent = psutil.cpu_times_percent(interval=2)
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": {
@@ -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.0
3
+ Version: 0.17.2
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=9U4QMkl1mVJargg_gQ7U8tMlvec4b1cqkTgRcmmyTTc,678
17
- oe_python_template/system/_service.py,sha256=DtjyJO-uJ0E07LQa4C3BJIi_kZc2Wiy0wi01JNJ1kJI,10276
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
@@ -27,14 +27,14 @@ oe_python_template/utils/_health.py,sha256=35QOWe2r5InrEpGtuVMym9dI5aRHS0HWf4BHB
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=40R0NZMqJUn0iUPERzohSUpJgU1HcJApIg1HipIxFCw,941
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.0.dist-info/METADATA,sha256=AxbtvFqYd9peyjSvnMvJqtTuYh_bQeMTbLu2Ztmv1uk,34606
37
- oe_python_template-0.17.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
- oe_python_template-0.17.0.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
39
- oe_python_template-0.17.0.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
40
- oe_python_template-0.17.0.dist-info/RECORD,,
36
+ oe_python_template-0.17.2.dist-info/METADATA,sha256=Gf3SVcKZPi3ZrCKhIluIsdCYz8Syos-7N432xff5fLM,34606
37
+ oe_python_template-0.17.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
+ oe_python_template-0.17.2.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
39
+ oe_python_template-0.17.2.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
40
+ oe_python_template-0.17.2.dist-info/RECORD,,