oe-python-template 0.16.8__py3-none-any.whl → 0.16.12__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.
@@ -49,7 +49,6 @@ class InfoDict(TypedDict, total=False):
49
49
  package: dict[str, Any]
50
50
  runtime: RuntimeDict
51
51
  settings: dict[str, Any]
52
- # Allow additional string keys with any values for service info
53
52
  __extra__: NotRequired[dict[str, Any]]
54
53
 
55
54
 
@@ -131,7 +130,7 @@ class Service(BaseService):
131
130
  """
132
131
  try:
133
132
  with socket(AF_INET, SOCK_DGRAM) as connection:
134
- connection.connect(("8.8.8.8", 80))
133
+ connection.connect((".".join(str(1) for _ in range(4)), 53))
135
134
  return str(connection.getsockname()[0])
136
135
  except Exception as e:
137
136
  message = f"Failed to get local IP: {e}"
@@ -153,8 +152,14 @@ class Service(BaseService):
153
152
  dict[str, Any]: Service configuration.
154
153
  """
155
154
  from uptime import boottime, uptime # noqa: PLC0415
155
+ import psutil # noqa: PLC0415
156
156
 
157
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
+
158
163
  rtn: InfoDict = {
159
164
  "package": {
160
165
  "version": __version__,
@@ -178,9 +183,34 @@ class Service(BaseService):
178
183
  "version": platform.version(),
179
184
  },
180
185
  "machine": {
181
- "arch": platform.machine(),
182
- "processor": platform.processor(),
183
- "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
+ },
184
214
  },
185
215
  "network": {
186
216
  "hostname": platform.node(),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oe-python-template
3
- Version: 0.16.8
3
+ Version: 0.16.12
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/
@@ -14,7 +14,7 @@ oe_python_template/system/__init__.py,sha256=7e2z8HATzy3dAIBXy5PM9rlCC7Rbu8m8Nap
14
14
  oe_python_template/system/_api.py,sha256=pBBCL1gXM7W5dgJqBLKuNFWES0pQF8mbUgQ7H7oHwh8,3714
15
15
  oe_python_template/system/_cli.py,sha256=fVO_TSIyiaMJ2ACeQ4gPy4QQZjmeBVnsxxsViuNGe8I,6990
16
16
  oe_python_template/system/_gui.py,sha256=9U4QMkl1mVJargg_gQ7U8tMlvec4b1cqkTgRcmmyTTc,678
17
- oe_python_template/system/_service.py,sha256=_Bj82UmU7dNRW_ufq1wew796KVfIhAGgfuA0LZdBU1k,8884
17
+ oe_python_template/system/_service.py,sha256=EDw4byGRO7uxSNW1zyAmTcbJUlOecayV7wXgk7_zP4I,10276
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
@@ -33,8 +33,8 @@ oe_python_template/utils/_service.py,sha256=atHAejvBucKXjzhsMSdOBBFa7rRD74zcV70P
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.16.8.dist-info/METADATA,sha256=FK59oLIJ2JbdSiDzpHMmUzJvlJtp5hiWO0p2dD2LAas,34606
37
- oe_python_template-0.16.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
- oe_python_template-0.16.8.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
39
- oe_python_template-0.16.8.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
40
- oe_python_template-0.16.8.dist-info/RECORD,,
36
+ oe_python_template-0.16.12.dist-info/METADATA,sha256=fV8DwQW12DIBUwEkqxFKo7qkyWaSOaKsfkoHAd-VFfE,34607
37
+ oe_python_template-0.16.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
+ oe_python_template-0.16.12.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
39
+ oe_python_template-0.16.12.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
40
+ oe_python_template-0.16.12.dist-info/RECORD,,