pmemstat 2.3.26__tar.gz → 2.3.28__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,3 +1,20 @@
1
+ Metadata-Version: 2.1
2
+ Name: pmemstat
3
+ Version: 2.3.28
4
+ Summary: Report Proportional Memory on Linux
5
+ Author-email: Joe Defen <joedef@duck.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/joedefen/pmemstat
8
+ Project-URL: Bug Tracker, https://github.com/joedefen/pmemstat/issues
9
+ Keywords: proportional memory,RAM,htop,top,monitor
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE.txt
16
+ Requires-Dist: psutil>5.9
17
+
1
18
  > **Quick Start**: from the CLI
2
19
  > * **If `python3 -V` shows v3.11 or later, install with `pipx`**:
3
20
  > * install `pipx` per your distro's guidance
@@ -178,22 +195,8 @@ If the `pipx` install is not acceptable, choose the best way to install:
178
195
  python -m pip install --user pmemstat
179
196
  # to uninstall: python -m pip uninstall pmemstat
180
197
  ```
181
- * Or **from PyPi as root**. This makes `pememstat` available to all users
182
- with `/usr/local/bin` on `$PATH`. Note: `PIP_BREAK_SYSTEM_PACKAGES=1`
183
- may be required on some distros.
198
+ * Or **from PyPi as root**. This makes `pmemstat` available to all users with `/usr/local/bin` on `$PATH`. Note: `PIP_BREAK_SYSTEM_PACKAGES=1` may be required on some distros.
184
199
  ```
185
200
  PIP_BREAK_SYSTEM_PACKAGES=1 sudo python -m pip install pmemstat
186
201
  # to uninstall: sudo python -m pip uninstall pmemstat
187
202
  ```
188
- * Or **from GitHub, scripted install**. The included `deploy` script installs
189
- a single-file `pmemstat` to `/usr/bin/pmemstat`;
190
- `deploy` installs/reinstalls `stickytape`, too.
191
- These commands install/update `pmemstat` w/o leftovers (except `stickytape`):
192
- ```
193
- # NOTE: requires "git" to be installed beforehand
194
- cd /tmp; rm -rf pmemstat;
195
- git clone https://github.com/joedefen/pmemstat.git;
196
- ./pmemstat/deploy; rm -rf pmemstat
197
- # to uninstall run: sudo rm /usr/bin/pmemstat
198
- ```
199
- * Or **from GitHub, manual install**: If you clone `pmemstat` from GitHub, then you may run its `deploy` script OR run "`pip install .`" as root or not OR just directly run `pmemstat/main.py`.
@@ -1,21 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: pmemstat
3
- Version: 2.3.26
4
- Summary: Report Proportional Memory on Linux
5
- Author-email: Joe Defen <joedef@duck.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/joedefen/pmemstat
8
- Project-URL: Bug Tracker, https://github.com/joedefen/pmemstat/issues
9
- Keywords: proportional memory,RAM,htop,top,monitor
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: POSIX :: Linux
13
- Requires-Python: >=3.8
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE.txt
16
- Requires-Dist: importlib-metadata; python_version < "3.8"
17
- Requires-Dist: psutil>5.9
18
-
19
1
  > **Quick Start**: from the CLI
20
2
  > * **If `python3 -V` shows v3.11 or later, install with `pipx`**:
21
3
  > * install `pipx` per your distro's guidance
@@ -196,22 +178,8 @@ If the `pipx` install is not acceptable, choose the best way to install:
196
178
  python -m pip install --user pmemstat
197
179
  # to uninstall: python -m pip uninstall pmemstat
198
180
  ```
199
- * Or **from PyPi as root**. This makes `pememstat` available to all users
200
- with `/usr/local/bin` on `$PATH`. Note: `PIP_BREAK_SYSTEM_PACKAGES=1`
201
- may be required on some distros.
181
+ * Or **from PyPi as root**. This makes `pmemstat` available to all users with `/usr/local/bin` on `$PATH`. Note: `PIP_BREAK_SYSTEM_PACKAGES=1` may be required on some distros.
202
182
  ```
203
183
  PIP_BREAK_SYSTEM_PACKAGES=1 sudo python -m pip install pmemstat
204
184
  # to uninstall: sudo python -m pip uninstall pmemstat
205
- ```
206
- * Or **from GitHub, scripted install**. The included `deploy` script installs
207
- a single-file `pmemstat` to `/usr/bin/pmemstat`;
208
- `deploy` installs/reinstalls `stickytape`, too.
209
- These commands install/update `pmemstat` w/o leftovers (except `stickytape`):
210
- ```
211
- # NOTE: requires "git" to be installed beforehand
212
- cd /tmp; rm -rf pmemstat;
213
- git clone https://github.com/joedefen/pmemstat.git;
214
- ./pmemstat/deploy; rm -rf pmemstat
215
- # to uninstall run: sudo rm /usr/bin/pmemstat
216
- ```
217
- * Or **from GitHub, manual install**: If you clone `pmemstat` from GitHub, then you may run its `deploy` script OR run "`pip install .`" as root or not OR just directly run `pmemstat/main.py`.
185
+ ```
@@ -32,7 +32,7 @@ build-backend = "setuptools.build_meta"
32
32
 
33
33
  [project]
34
34
  name = "pmemstat"
35
- version = "2.3.26"
35
+ version = "2.3.28"
36
36
  description = "Report Proportional Memory on Linux"
37
37
  authors = [
38
38
  {name = "Joe Defen", email = "joedef@duck.com"},
@@ -50,7 +50,6 @@ classifiers = [
50
50
  ]
51
51
 
52
52
  dependencies = [
53
- 'importlib-metadata; python_version<"3.8"',
54
53
  'psutil>5.9',
55
54
  ]
56
55
 
@@ -59,7 +58,7 @@ dependencies = [
59
58
  "Bug Tracker" = "https://github.com/joedefen/pmemstat/issues"
60
59
 
61
60
  [project.scripts]
62
- pmemstat = "pmemstat.pmemstat:run"
61
+ pmemstat = "pmemstat.main:run"
63
62
 
64
63
  [tool.setuptools]
65
64
  package-dir = {"" = "src"}
@@ -69,5 +68,5 @@ where = ["src"]
69
68
 
70
69
  [tool.setuptools.package-data]
71
70
  exclude = [
72
- "/pmemstat/__pycache__",
71
+ "__pycache__",
73
72
  ]
@@ -69,6 +69,7 @@ class SysStat:
69
69
  @staticmethod
70
70
  def refresh():
71
71
  """ TBD """
72
+ # pylint: disable=protected-access
72
73
  return SysStat.get_singleton()._refresh()
73
74
 
74
75
  def _refresh(self):
@@ -229,7 +230,7 @@ class CpuSmooth:
229
230
  self.hists.pop(0)
230
231
  try:
231
232
  _, _, delta_mono = pct(self.hists[-1], self.hists[-2])
232
- except:
233
+ except Exception:
233
234
  pass
234
235
  if delta_mono <= 0.0:
235
236
  self.hists.pop()
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Module to kill a set of processes and ensure they are really gone.
5
5
  """
6
- # pylint: disable=broad-except
6
+ # pylint: disable=broad-except,invalid-name,too-few-public-methods
7
7
 
8
8
  import os
9
9
  import sys
@@ -26,7 +26,7 @@ class KillThem():
26
26
  signal.SIGTERM, signal.SIGTERM, signal.SIGTERM,
27
27
  signal.SIGTERM, signal.SIGTERM, signal.SIGTERM,
28
28
  signal.SIGKILL, signal.SIGKILL, signal.SIGKILL]
29
- last_sig = ''
29
+ last_sig = ''
30
30
  for sig in sigs:
31
31
  for pid in list(self.pids):
32
32
  try:
@@ -4,7 +4,7 @@
4
4
  Custom Wrapper for python curses.
5
5
  """
6
6
  # pylint: disable=too-many-instance-attributes,too-many-arguments
7
- # pylint: disable=invalid-name,broad-except
7
+ # pylint: disable=invalid-name,broad-except,too-many-branches
8
8
 
9
9
  import traceback
10
10
  import atexit
@@ -111,6 +111,7 @@ class OptionSpinner:
111
111
  self._register(ns)
112
112
 
113
113
  def show_help_nav_keys(self, win):
114
+ """ Get/present standard verbiage for the navigation keys"""
114
115
  for line in Window.get_nav_keys_blurb().splitlines():
115
116
  if line:
116
117
  win.add_header(line)
@@ -440,7 +441,7 @@ class Window:
440
441
  if ind_pos >= 0:
441
442
  bot, cnt = ind_pos, 1
442
443
  if 0 < ind_pos < self.cols-1:
443
- width = (self.scroll_view_size/self.body.row_cnt*self.cols)
444
+ width = self.scroll_view_size/self.body.row_cnt * self.cols
444
445
  bot = max(int(round(ind_pos-width/2)), 1)
445
446
  top = min(int(round(ind_pos+width/2)), self.cols-1)
446
447
  cnt = top - bot
@@ -631,7 +632,7 @@ if __name__ == '__main__':
631
632
  for num in range(1, opts.pick_size):
632
633
  win.draw(num+idx*opts.pick_size, 0, f' addon: {loop}.{line}')
633
634
  win.render()
634
- answer = do_key(win.prompt(seconds=5))
635
+ do_key(win.prompt(seconds=5))
635
636
  win.clear()
636
637
 
637
638
  try:
File without changes
@@ -50,14 +50,9 @@ import curses
50
50
  from types import SimpleNamespace
51
51
  from io import StringIO
52
52
  from datetime import datetime, timedelta
53
- try:
54
- from Window import Window, OptionSpinner
55
- from KillThem import KillThem
56
- from CpuSmooth import CpuSmooth, SysStat
57
- except Exception:
58
- from pmemstat.Window import Window, OptionSpinner
59
- from pmemstat.KillThem import KillThem
60
- from pmemstat.CpuSmooth import CpuSmooth, SysStat
53
+ from pmemstat.Window import Window, OptionSpinner
54
+ from pmemstat.KillThem import KillThem
55
+ from pmemstat.CpuSmooth import CpuSmooth, SysStat
61
56
 
62
57
  # Trace Levels:
63
58
  # 0 - forced, temporary debugging (comment it out)
@@ -189,7 +184,7 @@ class ZramProjector:
189
184
  for key, value in vars(stat).items():
190
185
  stats[key] += value
191
186
  stats = SimpleNamespace(**stats)
192
- self.meminfo.MemZram = stats.mem_used_total
187
+ self.meminfo.MemZram = stats.mem_used_total
193
188
 
194
189
  e_used = meminfo.MemUsed - stats.mem_used_total + stats.orig_data_size
195
190
  ratio = None
@@ -212,7 +207,7 @@ class ZramProjector:
212
207
  # now add uncompressed memory
213
208
  e_max_used += meminfo.MemTotal - e_max_used/ratio
214
209
  self.e_max_used = e_max_used
215
- # self.e_max_used = max(e_max_total, e_used) # TODO: uncomment
210
+ # self.e_max_used = max(e_max_total, e_max_used)
216
211
  self.e_avail = e_max_used - e_used
217
212
 
218
213
 
@@ -1190,6 +1185,13 @@ class PmemStat:
1190
1185
  else:
1191
1186
  assert False, f'unsupported mode ({self.mode})'
1192
1187
 
1188
+ def rerun_module_as_root(module_name):
1189
+ """ rerun using the module name """
1190
+ if os.geteuid() != 0: # Re-run the script with sudo
1191
+ os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
1192
+ vp = ['sudo', sys.executable, '-m', module_name] + sys.argv[1:]
1193
+ os.execvp('sudo', vp)
1194
+
1193
1195
  def main():
1194
1196
  """Main loop"""
1195
1197
  global DebugLevel
@@ -1234,8 +1236,7 @@ def main():
1234
1236
 
1235
1237
  if not opts.run_as_user and os.geteuid() != 0:
1236
1238
  # Re-run the script with sudo needed and opted
1237
- sys.argv[0] = __file__
1238
- os.execvp('sudo', ['sudo', sys.executable] + sys.argv)
1239
+ rerun_module_as_root('pmemstat.main')
1239
1240
 
1240
1241
 
1241
1242
  if opts.min_delta_kb is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pmemstat
3
- Version: 2.3.26
3
+ Version: 2.3.28
4
4
  Summary: Report Proportional Memory on Linux
5
5
  Author-email: Joe Defen <joedef@duck.com>
6
6
  License: MIT
@@ -13,7 +13,6 @@ Classifier: Operating System :: POSIX :: Linux
13
13
  Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE.txt
16
- Requires-Dist: importlib-metadata; python_version < "3.8"
17
16
  Requires-Dist: psutil>5.9
18
17
 
19
18
  > **Quick Start**: from the CLI
@@ -196,22 +195,8 @@ If the `pipx` install is not acceptable, choose the best way to install:
196
195
  python -m pip install --user pmemstat
197
196
  # to uninstall: python -m pip uninstall pmemstat
198
197
  ```
199
- * Or **from PyPi as root**. This makes `pememstat` available to all users
200
- with `/usr/local/bin` on `$PATH`. Note: `PIP_BREAK_SYSTEM_PACKAGES=1`
201
- may be required on some distros.
198
+ * Or **from PyPi as root**. This makes `pmemstat` available to all users with `/usr/local/bin` on `$PATH`. Note: `PIP_BREAK_SYSTEM_PACKAGES=1` may be required on some distros.
202
199
  ```
203
200
  PIP_BREAK_SYSTEM_PACKAGES=1 sudo python -m pip install pmemstat
204
201
  # to uninstall: sudo python -m pip uninstall pmemstat
205
202
  ```
206
- * Or **from GitHub, scripted install**. The included `deploy` script installs
207
- a single-file `pmemstat` to `/usr/bin/pmemstat`;
208
- `deploy` installs/reinstalls `stickytape`, too.
209
- These commands install/update `pmemstat` w/o leftovers (except `stickytape`):
210
- ```
211
- # NOTE: requires "git" to be installed beforehand
212
- cd /tmp; rm -rf pmemstat;
213
- git clone https://github.com/joedefen/pmemstat.git;
214
- ./pmemstat/deploy; rm -rf pmemstat
215
- # to uninstall run: sudo rm /usr/bin/pmemstat
216
- ```
217
- * Or **from GitHub, manual install**: If you clone `pmemstat` from GitHub, then you may run its `deploy` script OR run "`pip install .`" as root or not OR just directly run `pmemstat/main.py`.
@@ -5,7 +5,7 @@ src/pmemstat/CpuSmooth.py
5
5
  src/pmemstat/KillThem.py
6
6
  src/pmemstat/Window.py
7
7
  src/pmemstat/__init__.py
8
- src/pmemstat/pmemstat.py
8
+ src/pmemstat/main.py
9
9
  src/pmemstat.egg-info/PKG-INFO
10
10
  src/pmemstat.egg-info/SOURCES.txt
11
11
  src/pmemstat.egg-info/dependency_links.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pmemstat = pmemstat.main:run
@@ -0,0 +1 @@
1
+ psutil>5.9
@@ -1,4 +0,0 @@
1
- from .pmemstat import run
2
-
3
- if __name__ == "__main__":
4
- run()
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- pmemstat = pmemstat.pmemstat:run
@@ -1,4 +0,0 @@
1
- psutil>5.9
2
-
3
- [:python_version < "3.8"]
4
- importlib-metadata
File without changes
File without changes