oe-python-template-example 0.4.21__tar.gz → 0.5.1__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.
Files changed (41) hide show
  1. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/PKG-INFO +1 -1
  2. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/pyproject.toml +2 -2
  3. oe_python_template_example-0.5.1/src/oe_python_template_example/system/_gui.py +26 -0
  4. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/system/_service.py +7 -3
  5. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_gui.py +1 -1
  6. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_process.py +2 -1
  7. oe_python_template_example-0.4.21/src/oe_python_template_example/system/_gui.py +0 -20
  8. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/.gitignore +0 -0
  9. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/LICENSE +0 -0
  10. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/README.md +0 -0
  11. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/__init__.py +0 -0
  12. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/api.py +0 -0
  13. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/cli.py +0 -0
  14. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/constants.py +0 -0
  15. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/__init__.py +0 -0
  16. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/_api.py +0 -0
  17. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/_cli.py +0 -0
  18. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/_constants.py +0 -0
  19. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/_gui.py +0 -0
  20. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/_models.py +0 -0
  21. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/_service.py +0 -0
  22. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/hello/_settings.py +0 -0
  23. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/system/__init__.py +0 -0
  24. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/system/_api.py +0 -0
  25. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/system/_cli.py +0 -0
  26. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/system/_settings.py +0 -0
  27. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/.vendored/bottle.py +0 -0
  28. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/__init__.py +0 -0
  29. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_api.py +0 -0
  30. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_cli.py +0 -0
  31. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_console.py +0 -0
  32. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_constants.py +0 -0
  33. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_di.py +0 -0
  34. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_health.py +0 -0
  35. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_log.py +0 -0
  36. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_logfire.py +0 -0
  37. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_notebook.py +0 -0
  38. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_sentry.py +0 -0
  39. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_service.py +0 -0
  40. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/_settings.py +0 -0
  41. {oe_python_template_example-0.4.21 → oe_python_template_example-0.5.1}/src/oe_python_template_example/utils/boot.py +0 -0
@@ -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/
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "oe-python-template-example"
3
- version = "0.4.21"
3
+ version = "0.5.1"
4
4
  description = "🧠 Example project scaffolded and kept up to date with OE Python Template (oe-python-template)."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -290,7 +290,7 @@ source = ["src/"]
290
290
 
291
291
 
292
292
  [tool.bumpversion]
293
- current_version = "0.4.21"
293
+ current_version = "0.5.1"
294
294
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
295
295
  serialize = ["{major}.{minor}.{patch}"]
296
296
  search = "{current_version}"
@@ -0,0 +1,26 @@
1
+ """Homepage (index) of GUI."""
2
+
3
+ from ..utils import BasePageBuilder, __project_name__, __version__ # noqa: TID252
4
+ from ._service import Service
5
+
6
+
7
+ class PageBuilder(BasePageBuilder):
8
+ @staticmethod
9
+ def register_pages() -> None:
10
+ from nicegui import run, ui # noqa: PLC0415
11
+
12
+ @ui.page("/info")
13
+ async def page_info() -> None:
14
+ """Homepage of GUI."""
15
+ ui.label(f"{__project_name__} v{__version__}").mark("LABEL_VERSION")
16
+ spinner = ui.spinner("dots", size="lg", color="red")
17
+ properties = {
18
+ "content": {"json": "Loading ..."},
19
+ "readOnly": True,
20
+ }
21
+ editor = ui.json_editor(properties).mark("JSON_EDITOR_INFO")
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,20 +0,0 @@
1
- """Homepage (index) of GUI."""
2
-
3
- from ..utils import BasePageBuilder, __project_name__, __version__ # noqa: TID252
4
- from ._service import Service
5
-
6
-
7
- class PageBuilder(BasePageBuilder):
8
- @staticmethod
9
- def register_pages() -> None:
10
- from nicegui import ui # noqa: PLC0415
11
-
12
- @ui.page("/info")
13
- def page_info() -> None:
14
- """Homepage of GUI."""
15
- ui.label(f"{__project_name__} v{__version__}").mark("LABEL_VERSION")
16
- ui.json_editor({
17
- "content": {"json": Service().info(True, True)},
18
- "readOnly": True,
19
- }).mark("JSON_EDITOR_INFO")
20
- ui.link("Home", "/").mark("LINK_HOME")