oe-python-template-example 0.4.17__py3-none-any.whl → 0.4.21__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.
@@ -12,7 +12,6 @@ from urllib.error import HTTPError
12
12
 
13
13
  from pydantic_settings import BaseSettings
14
14
  from requests import get
15
- from uptime import boottime, uptime
16
15
 
17
16
  from ..utils import ( # noqa: TID252
18
17
  UNHIDE_SENSITIVE_INFO,
@@ -50,7 +49,6 @@ class InfoDict(TypedDict, total=False):
50
49
  package: dict[str, Any]
51
50
  runtime: RuntimeDict
52
51
  settings: dict[str, Any]
53
- # Allow additional string keys with any values for service info
54
52
  __extra__: NotRequired[dict[str, Any]]
55
53
 
56
54
 
@@ -132,7 +130,7 @@ class Service(BaseService):
132
130
  """
133
131
  try:
134
132
  with socket(AF_INET, SOCK_DGRAM) as connection:
135
- connection.connect(("8.8.8.8", 80))
133
+ connection.connect((".".join(str(1) for _ in range(4)), 53))
136
134
  return str(connection.getsockname()[0])
137
135
  except Exception as e:
138
136
  message = f"Failed to get local IP: {e}"
@@ -153,7 +151,15 @@ class Service(BaseService):
153
151
  Returns:
154
152
  dict[str, Any]: Service configuration.
155
153
  """
154
+ import psutil # noqa: PLC0415
155
+ from uptime import boottime, uptime # noqa: PLC0415
156
+
156
157
  bootdatetime = boottime()
158
+ vmem = psutil.virtual_memory()
159
+ swap = psutil.swap_memory()
160
+ cpu_percent = psutil.cpu_percent(interval=5)
161
+ cpu_times_percent = psutil.cpu_times_percent(interval=5)
162
+
157
163
  rtn: InfoDict = {
158
164
  "package": {
159
165
  "version": __version__,
@@ -177,9 +183,34 @@ class Service(BaseService):
177
183
  "version": platform.version(),
178
184
  },
179
185
  "machine": {
180
- "arch": platform.machine(),
181
- "processor": platform.processor(),
182
- "cpu_count": os.cpu_count(),
186
+ "cpu": {
187
+ "percent": cpu_percent,
188
+ "load_avg": psutil.getloadavg(),
189
+ "user": cpu_times_percent.user,
190
+ "system": cpu_times_percent.system,
191
+ "idle": cpu_times_percent.idle,
192
+ "arch": platform.machine(),
193
+ "processor": platform.processor(),
194
+ "count": os.cpu_count(),
195
+ "frequency": {
196
+ "current": psutil.cpu_freq().max,
197
+ "min": psutil.cpu_freq().max,
198
+ "max": psutil.cpu_freq().max,
199
+ },
200
+ },
201
+ "memory": {
202
+ "percent": vmem.percent,
203
+ "total": vmem.total,
204
+ "available": vmem.available,
205
+ "used": vmem.used,
206
+ "free": vmem.free,
207
+ },
208
+ "swap": {
209
+ "percent": swap.percent,
210
+ "total": swap.total,
211
+ "used": swap.used,
212
+ "free": swap.free,
213
+ },
183
214
  },
184
215
  "network": {
185
216
  "hostname": platform.node(),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oe-python-template-example
3
- Version: 0.4.17
3
+ Version: 0.4.21
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/
@@ -14,7 +14,7 @@ oe_python_template_example/system/__init__.py,sha256=7e2z8HATzy3dAIBXy5PM9rlCC7R
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
16
  oe_python_template_example/system/_gui.py,sha256=9U4QMkl1mVJargg_gQ7U8tMlvec4b1cqkTgRcmmyTTc,678
17
- oe_python_template_example/system/_service.py,sha256=2Vkbn28ipWRMKRt4T9O_CR_uk9pX1mM4jb21DMOvpus,8858
17
+ oe_python_template_example/system/_service.py,sha256=-7fafDudSthfmMayHV_SNYxI6y0CKvC-sxSozyV69qQ,10276
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
@@ -33,8 +33,8 @@ oe_python_template_example/utils/_service.py,sha256=atHAejvBucKXjzhsMSdOBBFa7rRD
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.17.dist-info/METADATA,sha256=0qNhHWX9S5HOd8TPjZBUJS4QRHcc9LuOQrt2FOVfydY,36051
37
- oe_python_template_example-0.4.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
- oe_python_template_example-0.4.17.dist-info/entry_points.txt,sha256=S2eCPB45b1Wgj_GsDRFAN-e4h7dBA5UPxT8od98erDE,82
39
- oe_python_template_example-0.4.17.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
40
- oe_python_template_example-0.4.17.dist-info/RECORD,,
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,,