glances_api 0.8.0__tar.gz → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2024 Fabian Affolter <fabian@affolter-engineering.ch>
3
+ Copyright (c) 2017-2025 Fabian Affolter <fabian@affolter-engineering.ch>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,12 +1,12 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: glances_api
3
- Version: 0.8.0
3
+ Version: 0.9.1
4
4
  Summary: Python API for interacting with Glances
5
- Home-page: https://github.com/home-assistant-ecosystem/python-glances-api
6
5
  License: MIT
6
+ License-File: LICENSE
7
7
  Author: Fabian Affolter
8
8
  Author-email: fabian@affolter-engineering.ch
9
- Requires-Python: >=3.11,<4.0
9
+ Requires-Python: >=3.13,<4.0
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Environment :: Console
12
12
  Classifier: Intended Audience :: Developers
@@ -15,42 +15,42 @@ Classifier: Operating System :: MacOS :: MacOS X
15
15
  Classifier: Operating System :: Microsoft :: Windows
16
16
  Classifier: Operating System :: POSIX
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.11
19
- Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
20
  Classifier: Topic :: Utilities
21
- Requires-Dist: httpx (>=0.23,<1)
21
+ Requires-Dist: httpx (>=0.28,<1)
22
+ Project-URL: Homepage, https://github.com/home-assistant-ecosystem/python-glances-api
22
23
  Project-URL: Repository, https://github.com/home-assistant-ecosystem/python-glances-api/releases
23
- Description-Content-Type: text/x-rst
24
+ Description-Content-Type: text/markdown
24
25
 
25
26
  python-glances-api
26
27
  ==================
27
28
 
28
- A Python client for interacting with `Glances <https://nicolargo.github.io/glances/>`_.
29
+ A Python client for interacting with [Glances](https://nicolargo.github.io/glances/).
29
30
 
30
31
  This module is not official, developed, supported or endorsed by Glances.
31
32
 
32
33
  Installation
33
34
  ------------
34
35
 
35
- The module is available from the `Python Package Index <https://pypi.python.org/pypi>`_.
36
+ The module is available from the [Python Package Index](https://pypi.python.org/pypi).
36
37
 
37
- .. code:: bash
38
-
39
- $ pip3 install glances_api
38
+ ```bash
39
+ $ pip3 install glances_api
40
+ ```
40
41
 
41
42
  Or on a Fedora-based system or on a CentOS/RHEL machine with has EPEL enabled.
42
43
 
43
- .. code:: bash
44
-
45
- $ sudo dnf -y install python3-glances-api
46
-
47
-
48
- For Nix or NixOS is `pre-packed module <https://search.nixos.org/packages?channel=unstable&query=glances-api>`_
49
- available. The lastest release is usually present in the ``unstable`` channel.
44
+ ```bash
45
+ $ sudo dnf -y install python3-glances-api
46
+ ```
50
47
 
51
- .. code:: bash
48
+ For Nix or NixOS is[ pre-packed module](https://search.nixos.org/packages?channel=unstable&query=glances-api)
49
+ available. The latest release is usually present in the ``unstable`` channel.
52
50
 
53
- $ nix-env -iA nixos.python3Packages.glances-api
51
+ ```bash
52
+ $ nix-env -iA nixos.python3Packages.glances-api
53
+ ```
54
54
 
55
55
  Usage
56
56
  -----
@@ -0,0 +1,38 @@
1
+ python-glances-api
2
+ ==================
3
+
4
+ A Python client for interacting with [Glances](https://nicolargo.github.io/glances/).
5
+
6
+ This module is not official, developed, supported or endorsed by Glances.
7
+
8
+ Installation
9
+ ------------
10
+
11
+ The module is available from the [Python Package Index](https://pypi.python.org/pypi).
12
+
13
+ ```bash
14
+ $ pip3 install glances_api
15
+ ```
16
+
17
+ Or on a Fedora-based system or on a CentOS/RHEL machine with has EPEL enabled.
18
+
19
+ ```bash
20
+ $ sudo dnf -y install python3-glances-api
21
+ ```
22
+
23
+ For Nix or NixOS is[ pre-packed module](https://search.nixos.org/packages?channel=unstable&query=glances-api)
24
+ available. The latest release is usually present in the ``unstable`` channel.
25
+
26
+ ```bash
27
+ $ nix-env -iA nixos.python3Packages.glances-api
28
+ ```
29
+
30
+ Usage
31
+ -----
32
+
33
+ The file ``example.py`` contains an example about how to use this module.
34
+
35
+ License
36
+ -------
37
+
38
+ ``python-glances-api`` is licensed under MIT, for more details check LICENSE.
@@ -134,8 +134,9 @@ class Glances:
134
134
  }
135
135
  if data := self.data.get("load"):
136
136
  sensor_data["load"] = {
137
- "processor_load": data.get("min15")
138
- or self.data["cpu"]["total"] # to be checked
137
+ "processor_load": data.get("min15"),
138
+ "processor_load_1m": data.get("min1"),
139
+ "processor_load_5m": data.get("min5"),
139
140
  }
140
141
  if data := self.data.get("processcount"):
141
142
  sensor_data["processcount"] = {
@@ -182,6 +183,7 @@ class Glances:
182
183
  # Glances v4 provides a list of containers
183
184
  containers_data = self.data.get("containers")
184
185
  if containers_data:
186
+ sensor_data["containers"] = {}
185
187
  active_containers = [
186
188
  container
187
189
  for container in containers_data
@@ -198,6 +200,13 @@ class Glances:
198
200
  for container in active_containers:
199
201
  mem_use += container["memory"].get("usage", 0)
200
202
  sensor_data["docker"]["docker_memory_use"] = round(mem_use / 1024**2, 1)
203
+ for container in active_containers:
204
+ sensor_data["containers"][container["name"]] = {
205
+ "container_cpu_use": round(container["cpu"].get("total", 0), 1),
206
+ "container_memory_use": round(
207
+ container["memory"].get("usage", 0) / 1024**2, 1
208
+ ),
209
+ }
201
210
  if data := self.data.get("raid"):
202
211
  sensor_data["raid"] = data
203
212
  if data := self.data.get("uptime"):
@@ -1,11 +1,11 @@
1
1
  [tool.poetry]
2
2
  name = "glances_api"
3
- version = "0.8.0"
3
+ version = "0.9.1"
4
4
  description = "Python API for interacting with Glances"
5
5
  authors = ["Fabian Affolter <fabian@affolter-engineering.ch>"]
6
6
  homepage = "https://github.com/home-assistant-ecosystem/python-glances-api"
7
7
  repository = "https://github.com/home-assistant-ecosystem/python-glances-api/releases"
8
- readme = "README.rst"
8
+ readme = "README.md"
9
9
  license = "MIT"
10
10
  classifiers = [
11
11
  "Development Status :: 3 - Alpha",
@@ -18,16 +18,16 @@ classifiers = [
18
18
  ]
19
19
 
20
20
  [tool.poetry.dependencies]
21
- python = "^3.11"
22
- httpx = ">=0.23,<1"
21
+ python = "^3.13"
22
+ httpx = ">=0.28,<1"
23
23
 
24
- [tool.poetry.dev-dependencies]
25
- black = "^24.3"
26
- pytest = "^8"
27
- pytest-httpx = ">0.15,<1"
28
- pytest-asyncio = "^0.16.0"
24
+ [tool.poetry.group.dev.dependencies]
25
+ black = "^26.3"
26
+ pytest = "^9"
27
+ pytest-httpx = ">0.35,<1"
28
+ pytest-asyncio = "^1.3.0"
29
29
  isort = "^5.10.0"
30
- mypy = "^0.971"
30
+ mypy = "^1.20.0"
31
31
 
32
32
  [tool.mypy]
33
33
  check_untyped_defs = true
@@ -43,14 +43,6 @@ exclude = [
43
43
  'pyproject.toml',
44
44
  ]
45
45
 
46
- [[tool.mypy.overrides]]
47
- module = "tests.*"
48
- allow_untyped_defs = true
49
-
50
- [[tool.mypy.overrides]]
51
- module = "docs.*"
52
- ignore_errors = true
53
-
54
46
  [build-system]
55
47
  requires = ["poetry-core>=1.0.0"]
56
48
  build-backend = "poetry.core.masonry.api"
@@ -1,39 +0,0 @@
1
- python-glances-api
2
- ==================
3
-
4
- A Python client for interacting with `Glances <https://nicolargo.github.io/glances/>`_.
5
-
6
- This module is not official, developed, supported or endorsed by Glances.
7
-
8
- Installation
9
- ------------
10
-
11
- The module is available from the `Python Package Index <https://pypi.python.org/pypi>`_.
12
-
13
- .. code:: bash
14
-
15
- $ pip3 install glances_api
16
-
17
- Or on a Fedora-based system or on a CentOS/RHEL machine with has EPEL enabled.
18
-
19
- .. code:: bash
20
-
21
- $ sudo dnf -y install python3-glances-api
22
-
23
-
24
- For Nix or NixOS is `pre-packed module <https://search.nixos.org/packages?channel=unstable&query=glances-api>`_
25
- available. The lastest release is usually present in the ``unstable`` channel.
26
-
27
- .. code:: bash
28
-
29
- $ nix-env -iA nixos.python3Packages.glances-api
30
-
31
- Usage
32
- -----
33
-
34
- The file ``example.py`` contains an example about how to use this module.
35
-
36
- License
37
- -------
38
-
39
- ``python-glances-api`` is licensed under MIT, for more details check LICENSE.