oe-python-template-example 0.4.21__py3-none-any.whl → 0.5.1__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:
@@ -157,8 +161,8 @@ class Service(BaseService):
157
161
  bootdatetime = boottime()
158
162
  vmem = psutil.virtual_memory()
159
163
  swap = psutil.swap_memory()
160
- cpu_percent = psutil.cpu_percent(interval=5)
161
- cpu_times_percent = psutil.cpu_times_percent(interval=5)
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": {
@@ -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-example
3
- Version: 0.4.21
3
+ Version: 0.5.1
4
4
  Summary: 🧠 Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
5
5
  Project-URL: Homepage, https://oe-python-template-example.readthedocs.io/en/latest/
6
6
  Project-URL: Documentation, https://oe-python-template-example.readthedocs.io/en/latest/
@@ -13,8 +13,8 @@ oe_python_template_example/hello/_settings.py,sha256=Q14SqSvBJYFuofA-tbvBwO30sVy
13
13
  oe_python_template_example/system/__init__.py,sha256=7e2z8HATzy3dAIBXy5PM9rlCC7Rbu8m8NapROdrf3Wk,624
14
14
  oe_python_template_example/system/_api.py,sha256=pBBCL1gXM7W5dgJqBLKuNFWES0pQF8mbUgQ7H7oHwh8,3714
15
15
  oe_python_template_example/system/_cli.py,sha256=fVO_TSIyiaMJ2ACeQ4gPy4QQZjmeBVnsxxsViuNGe8I,6990
16
- oe_python_template_example/system/_gui.py,sha256=9U4QMkl1mVJargg_gQ7U8tMlvec4b1cqkTgRcmmyTTc,678
17
- oe_python_template_example/system/_service.py,sha256=-7fafDudSthfmMayHV_SNYxI6y0CKvC-sxSozyV69qQ,10276
16
+ oe_python_template_example/system/_gui.py,sha256=MG2nyHZoqD1E4TIrmvBnGwu8-hgKpFt1kKd2aF10FBI,961
17
+ oe_python_template_example/system/_service.py,sha256=VlQrRHLq2HUGmYyfHoiiIuvfMPemo94ZwkUsd0VLeTY,10443
18
18
  oe_python_template_example/system/_settings.py,sha256=MwMAJYifJ6jGImeSh4e9shmIXmiUSuQGHXz_Ts0mSdk,901
19
19
  oe_python_template_example/utils/__init__.py,sha256=oM8v1ozMOeBQG-EbBtEGbnuGk52mYNDAmNoR7vNQ7MY,2050
20
20
  oe_python_template_example/utils/_api.py,sha256=GSI-HPtSdTFv0qP5aTDPa2WS3ewVa1slusG6dvxSu0Y,2474
@@ -22,19 +22,19 @@ oe_python_template_example/utils/_cli.py,sha256=J_mFtXZ1gGeovGrE5i3wlokTOBfiTTKE
22
22
  oe_python_template_example/utils/_console.py,sha256=u0-utcdRmVu4rabrYUyNOx8yPxLhxB3E92m22kSCwPQ,293
23
23
  oe_python_template_example/utils/_constants.py,sha256=WfXarYsOP1z3iv-DNEw7FNBekLXEz2rHYICAaqdoQd8,3301
24
24
  oe_python_template_example/utils/_di.py,sha256=J1-f6xtbnR88VfRAsRMl5m6eqt-Lf3c7ABSJOxNzlvU,2399
25
- oe_python_template_example/utils/_gui.py,sha256=mm7-PFPZsVAYISENM91ezlefs_Ax5dEOPzT7-u5xQe0,7749
25
+ oe_python_template_example/utils/_gui.py,sha256=e3fYHNJQNIMbV74zu27Wp_fog3QqbIDukqRWUE_f17Y,7754
26
26
  oe_python_template_example/utils/_health.py,sha256=35QOWe2r5InrEpGtuVMym9dI5aRHS0HWf4BHBRAUIj0,4102
27
27
  oe_python_template_example/utils/_log.py,sha256=t6CAlSvnwZhls0cPWupodXWGGjNlMHF8T9W69ngIV-E,5156
28
28
  oe_python_template_example/utils/_logfire.py,sha256=wZYNVowQx7kh3XJoJ59FjUKdrta7tp6cXOJRUT6lDU8,2128
29
29
  oe_python_template_example/utils/_notebook.py,sha256=IZOQTRKVV5htwXZIpZIZbAAOo86NK1L8vYkg1o7HW1Q,2114
30
- oe_python_template_example/utils/_process.py,sha256=40R0NZMqJUn0iUPERzohSUpJgU1HcJApIg1HipIxFCw,941
30
+ oe_python_template_example/utils/_process.py,sha256=m6RQZrr8phMjwmtQfXXra6FakB6Cn4_2wP0YyEfjU6M,963
31
31
  oe_python_template_example/utils/_sentry.py,sha256=6SZknbGBpdZHYUpF-11qk6UYBM-c79U8D9sF4517kdU,6369
32
32
  oe_python_template_example/utils/_service.py,sha256=atHAejvBucKXjzhsMSdOBBFa7rRD74zcV70Pp0pl0Tg,1038
33
33
  oe_python_template_example/utils/_settings.py,sha256=owFoaHEzJnVD3EVyOWF4rfIY7g6eLnU6rN0m4VHhCbA,2464
34
34
  oe_python_template_example/utils/boot.py,sha256=Qgq1sjT8d3fcfibnMyx5CVUJ_KKXgFI3ozZUIJbhh4I,2921
35
35
  oe_python_template_example/utils/.vendored/bottle.py,sha256=kZAZmh3nRzCUf-9IKGpv0yqlMciZMA_DNaaMDdcQmt0,175437
36
- oe_python_template_example-0.4.21.dist-info/METADATA,sha256=faEK2GO9EZ5JsUHtPAJw5rMsP7mz8kRqvpwd55JfhRU,36051
37
- oe_python_template_example-0.4.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
- oe_python_template_example-0.4.21.dist-info/entry_points.txt,sha256=S2eCPB45b1Wgj_GsDRFAN-e4h7dBA5UPxT8od98erDE,82
39
- oe_python_template_example-0.4.21.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
40
- oe_python_template_example-0.4.21.dist-info/RECORD,,
36
+ oe_python_template_example-0.5.1.dist-info/METADATA,sha256=jdm9isailL0sP91aOt3lzA8p6yaiil9-C44aV67u9F8,36050
37
+ oe_python_template_example-0.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
+ oe_python_template_example-0.5.1.dist-info/entry_points.txt,sha256=S2eCPB45b1Wgj_GsDRFAN-e4h7dBA5UPxT8od98erDE,82
39
+ oe_python_template_example-0.5.1.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
40
+ oe_python_template_example-0.5.1.dist-info/RECORD,,