macpm 3.0__tar.gz → 3.0.2__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 (80) hide show
  1. {macpm-3.0 → macpm-3.0.2}/CHANGELOG.md +31 -0
  2. {macpm-3.0/macpm.egg-info → macpm-3.0.2}/PKG-INFO +12 -4
  3. {macpm-3.0 → macpm-3.0.2}/README.md +10 -2
  4. {macpm-3.0 → macpm-3.0.2}/RELEASE.md +11 -11
  5. {macpm-3.0 → macpm-3.0.2}/docs/linux-port.md +1 -1
  6. {macpm-3.0 → macpm-3.0.2}/macpm/__init__.py +1 -1
  7. {macpm-3.0 → macpm-3.0.2}/macpm/macpm.py +107 -55
  8. {macpm-3.0 → macpm-3.0.2/macpm.egg-info}/PKG-INFO +12 -4
  9. {macpm-3.0 → macpm-3.0.2}/macpm.egg-info/SOURCES.txt +1 -0
  10. {macpm-3.0 → macpm-3.0.2}/macpm.egg-info/requires.txt +1 -1
  11. {macpm-3.0 → macpm-3.0.2}/setup.py +2 -2
  12. {macpm-3.0 → macpm-3.0.2}/tests/test_cli.py +1 -1
  13. macpm-3.0.2/tests/test_dashing_compat.py +113 -0
  14. {macpm-3.0 → macpm-3.0.2}/LICENSE +0 -0
  15. {macpm-3.0 → macpm-3.0.2}/MANIFEST.in +0 -0
  16. {macpm-3.0 → macpm-3.0.2}/macpm/__main__.py +0 -0
  17. {macpm-3.0 → macpm-3.0.2}/macpm/backend.py +0 -0
  18. {macpm-3.0 → macpm-3.0.2}/macpm/capabilities.py +0 -0
  19. {macpm-3.0 → macpm-3.0.2}/macpm/dump.py +0 -0
  20. {macpm-3.0 → macpm-3.0.2}/macpm/gpuview.py +0 -0
  21. {macpm-3.0 → macpm-3.0.2}/macpm/ioreport.py +0 -0
  22. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/__init__.py +0 -0
  23. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/cpu.py +0 -0
  24. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/gpu.py +0 -0
  25. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/modelname.py +0 -0
  26. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/net.py +0 -0
  27. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/power.py +0 -0
  28. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/proc.py +0 -0
  29. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/sampler.py +0 -0
  30. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/soc.py +0 -0
  31. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/sysfs.py +0 -0
  32. {macpm-3.0 → macpm-3.0.2}/macpm/linux_backend/thermal.py +0 -0
  33. {macpm-3.0 → macpm-3.0.2}/macpm/macos_gpu.py +0 -0
  34. {macpm-3.0 → macpm-3.0.2}/macpm/metrics.py +0 -0
  35. {macpm-3.0 → macpm-3.0.2}/macpm/netinfo.py +0 -0
  36. {macpm-3.0 → macpm-3.0.2}/macpm/netmodel.py +0 -0
  37. {macpm-3.0 → macpm-3.0.2}/macpm/network.py +0 -0
  38. {macpm-3.0 → macpm-3.0.2}/macpm/probe.py +0 -0
  39. {macpm-3.0 → macpm-3.0.2}/macpm/processes.py +0 -0
  40. {macpm-3.0 → macpm-3.0.2}/macpm/sampler.py +0 -0
  41. {macpm-3.0 → macpm-3.0.2}/macpm/sensors.py +0 -0
  42. {macpm-3.0 → macpm-3.0.2}/macpm/smc.py +0 -0
  43. {macpm-3.0 → macpm-3.0.2}/macpm/soc.py +0 -0
  44. {macpm-3.0 → macpm-3.0.2}/macpm/tui.py +0 -0
  45. {macpm-3.0 → macpm-3.0.2}/macpm.egg-info/dependency_links.txt +0 -0
  46. {macpm-3.0 → macpm-3.0.2}/macpm.egg-info/entry_points.txt +0 -0
  47. {macpm-3.0 → macpm-3.0.2}/macpm.egg-info/not-zip-safe +0 -0
  48. {macpm-3.0 → macpm-3.0.2}/macpm.egg-info/top_level.txt +0 -0
  49. {macpm-3.0 → macpm-3.0.2}/packaging/README.txt +0 -0
  50. {macpm-3.0 → macpm-3.0.2}/packaging/build.sh +0 -0
  51. {macpm-3.0 → macpm-3.0.2}/packaging/entry_tui.py +0 -0
  52. {macpm-3.0 → macpm-3.0.2}/packaging/install.sh +0 -0
  53. {macpm-3.0 → macpm-3.0.2}/packaging/linux/Dockerfile +0 -0
  54. {macpm-3.0 → macpm-3.0.2}/packaging/linux/README.txt +0 -0
  55. {macpm-3.0 → macpm-3.0.2}/packaging/macpm.command +0 -0
  56. {macpm-3.0 → macpm-3.0.2}/pyproject.toml +0 -0
  57. {macpm-3.0 → macpm-3.0.2}/setup.cfg +0 -0
  58. {macpm-3.0 → macpm-3.0.2}/tests/__init__.py +0 -0
  59. {macpm-3.0 → macpm-3.0.2}/tests/linux_fixtures.py +0 -0
  60. {macpm-3.0 → macpm-3.0.2}/tests/test_calc_freq.py +0 -0
  61. {macpm-3.0 → macpm-3.0.2}/tests/test_gpuview.py +0 -0
  62. {macpm-3.0 → macpm-3.0.2}/tests/test_layout.py +0 -0
  63. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_cpu.py +0 -0
  64. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_gpu.py +0 -0
  65. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_ixsmi.py +0 -0
  66. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_modelname.py +0 -0
  67. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_net.py +0 -0
  68. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_nvidia.py +0 -0
  69. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_power.py +0 -0
  70. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_sampler.py +0 -0
  71. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_thermal.py +0 -0
  72. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_view.py +0 -0
  73. {macpm-3.0 → macpm-3.0.2}/tests/test_linux_wiring.py +0 -0
  74. {macpm-3.0 → macpm-3.0.2}/tests/test_netinfo.py +0 -0
  75. {macpm-3.0 → macpm-3.0.2}/tests/test_network.py +0 -0
  76. {macpm-3.0 → macpm-3.0.2}/tests/test_probe.py +0 -0
  77. {macpm-3.0 → macpm-3.0.2}/tests/test_processes.py +0 -0
  78. {macpm-3.0 → macpm-3.0.2}/tests/test_sampler.py +0 -0
  79. {macpm-3.0 → macpm-3.0.2}/tests/test_sampler_macos.py +0 -0
  80. {macpm-3.0 → macpm-3.0.2}/tests/test_sensors.py +0 -0
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.2 — 2026-11-15
4
+
5
+ ### Fixed
6
+
7
+ - macpm declares `dashing>=0.1,<0.2` again: dashing 0.2 replaced the
8
+ `Tile._display(tbox, parent)` / `_draw_title(tbox, ...)` drawing protocol
9
+ with a buffer-based one, and macpm's custom `FillVSplit`/`SensorPanel`
10
+ layout overrides rely on the 0.1 signatures. Installing on a machine that
11
+ already had dashing 0.2 produced
12
+ `TypeError: Tile._draw_borders_and_title() missing 1 required positional
13
+ argument: 'tbox'`. A runtime guard now names the problem and the fix
14
+ (`pip install 'dashing<0.2'`) if 0.2 is forced in.
15
+ - The 3.0.1 colour compatibility stays in place, so the code is ready for a
16
+ future port to the 0.2 API.
17
+
18
+ ## 3.0.1 — 2026-11-15
19
+
20
+ ### Fixed
21
+
22
+ - The colour switch (`←` / `→`) crashed with
23
+ `AttributeError: can't set attribute 'border_color'` on dashing 0.2: that
24
+ release turned tile colours into read-only RGB properties. macpm now sets
25
+ colours through `Tile.set_color` when it exists (translating the ANSI index
26
+ to RGB) and keeps the plain attributes on dashing 0.1, so both generations
27
+ work.
28
+ - The applied colour is tracked internally instead of read back from
29
+ `border_color`; on dashing 0.2 that value is an RGB object, so the comparison
30
+ was always true and cleared the screen on every frame.
31
+ - dashing 0.2 rejects ANSI index 8 in constructors; the eighth theme maps to
32
+ grey there instead of raising `IndexError`.
33
+
3
34
  ## 3.0 — 2026-11-14
4
35
 
5
36
  The Linux release. The same package and the same TUI now run on x86_64 and
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macpm
3
- Version: 3.0
3
+ Version: 3.0.2
4
4
  Summary: Performance monitoring CLI for Apple Silicon and Linux
5
5
  Home-page: https://github.com/visualcjy/macpm
6
6
  Author: Jinyu Chen
@@ -23,7 +23,7 @@ Classifier: Topic :: System :: Monitoring
23
23
  Requires-Python: >=3.9
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
- Requires-Dist: dashing>=0.1
26
+ Requires-Dist: dashing<0.2,>=0.1
27
27
  Requires-Dist: psutil>=5.9
28
28
  Requires-Dist: humanize>=4.0
29
29
  Dynamic: author
@@ -314,7 +314,7 @@ shows it as a `MODEL` column.
314
314
 
315
315
  A single-GPU machine keeps the older layout: card summary on top, process table
316
316
  below. Every view's footer starts with the app name and version
317
- (`macpm v3.0 · q quit …`).
317
+ (`macpm v3.0.2 · q quit …`).
318
318
 
319
319
  ```text
320
320
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -328,7 +328,7 @@ below. Every view's footer starts with the app name and version
328
328
  │ └ 222 Xorg 2.0G │
329
329
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
330
330
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
331
- └ macpm v3.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
331
+ └ macpm v3.0.2 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
332
332
  ```
333
333
 
334
334
  | Platform | What fills each row |
@@ -580,6 +580,14 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
580
580
  - **The network header has no public IP** — the lookup is disabled with
581
581
  `--no-public-ip`, or the machine is offline / the service is blocked. The
582
582
  local IP, prefix and gateway still show.
583
+ - **`ModuleNotFoundError: No module named 'macpm.macpm'` after a root install**
584
+ — `sudo pip install` inherited a restrictive umask (e.g. `0007`), so the
585
+ package directories were written as `root:root 750` and a normal user cannot
586
+ read them; Python then treats them as namespace packages (the same happens to
587
+ `blessed`, which reports `cannot import name 'Terminal'`). Reinstall with a
588
+ sane umask (`sudo sh -c 'umask 022; pip install --force-reinstall macpm'`),
589
+ install with `pip install --user`, or fix the modes (`sudo chmod -R a+rX
590
+ /usr/local/lib/python3.*/dist-packages/macpm*` and the dependencies).
583
591
 
584
592
  ## Changelog
585
593
 
@@ -272,7 +272,7 @@ shows it as a `MODEL` column.
272
272
 
273
273
  A single-GPU machine keeps the older layout: card summary on top, process table
274
274
  below. Every view's footer starts with the app name and version
275
- (`macpm v3.0 · q quit …`).
275
+ (`macpm v3.0.2 · q quit …`).
276
276
 
277
277
  ```text
278
278
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -286,7 +286,7 @@ below. Every view's footer starts with the app name and version
286
286
  │ └ 222 Xorg 2.0G │
287
287
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
288
288
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
289
- └ macpm v3.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
289
+ └ macpm v3.0.2 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
290
290
  ```
291
291
 
292
292
  | Platform | What fills each row |
@@ -538,6 +538,14 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
538
538
  - **The network header has no public IP** — the lookup is disabled with
539
539
  `--no-public-ip`, or the machine is offline / the service is blocked. The
540
540
  local IP, prefix and gateway still show.
541
+ - **`ModuleNotFoundError: No module named 'macpm.macpm'` after a root install**
542
+ — `sudo pip install` inherited a restrictive umask (e.g. `0007`), so the
543
+ package directories were written as `root:root 750` and a normal user cannot
544
+ read them; Python then treats them as namespace packages (the same happens to
545
+ `blessed`, which reports `cannot import name 'Terminal'`). Reinstall with a
546
+ sane umask (`sudo sh -c 'umask 022; pip install --force-reinstall macpm'`),
547
+ install with `pip install --user`, or fix the modes (`sudo chmod -R a+rX
548
+ /usr/local/lib/python3.*/dist-packages/macpm*` and the dependencies).
541
549
 
542
550
  ## Changelog
543
551
 
@@ -1,4 +1,4 @@
1
- # Releasing macpm 3.0
1
+ # Releasing macpm 3.0.2
2
2
 
3
3
  This checklist prepares a GitHub tag and a PyPI upload. It does not push or
4
4
  publish anything by itself.
@@ -7,11 +7,11 @@ publish anything by itself.
7
7
 
8
8
  - macOS Apple Silicon, Python 3.9+.
9
9
  - Clean working tree (`git status`), all tests passing.
10
- - Version is `3.0` in:
10
+ - Version is `3.0.2` in:
11
11
  - `setup.py`
12
12
  - `macpm/__init__.py`
13
- - `macpm/macpm.py` (`version = 'macpm v3.0'`)
14
- - `CHANGELOG.md` has the 3.0 entry.
13
+ - `macpm/macpm.py` (`version = 'macpm v3.0.2'`)
14
+ - `CHANGELOG.md` has the 3.0.2 entry.
15
15
 
16
16
  ## 2. Test from source
17
17
 
@@ -38,7 +38,7 @@ Test the wheel in a **clean** venv (this is the real "no source tree" test):
38
38
 
39
39
  ```sh
40
40
  python3 -m venv /tmp/macpm-wheel-test
41
- /tmp/macpm-wheel-test/bin/pip install dist/macpm-3.0-py3-none-any.whl
41
+ /tmp/macpm-wheel-test/bin/pip install dist/macpm-3.0.2-py3-none-any.whl
42
42
  /tmp/macpm-wheel-test/bin/macpm --help
43
43
  /tmp/macpm-wheel-test/bin/macpm-dump # Ctrl+C
44
44
  ```
@@ -78,13 +78,13 @@ Manual alternative (fallback, e.g. when OIDC is unavailable):
78
78
  ```sh
79
79
  # requires a PyPI API token in ~/.pypirc or TWINE_PASSWORD
80
80
  python3 -m twine upload --non-interactive \
81
- dist/macpm-3.0.tar.gz dist/macpm-3.0-py3-none-any.whl
81
+ dist/macpm-3.0.2.tar.gz dist/macpm-3.0.2-py3-none-any.whl
82
82
  ```
83
83
 
84
84
  Then verify:
85
85
 
86
86
  ```sh
87
- python3 -m pip install --upgrade macpm==3.0
87
+ python3 -m pip install --upgrade macpm==3.0.2
88
88
  macpm --version
89
89
  ```
90
90
 
@@ -93,10 +93,10 @@ macpm --version
93
93
  ```sh
94
94
  git add setup.py pyproject.toml MANIFEST.in README.md CHANGELOG.md RELEASE.md \
95
95
  macpm packaging tests .github bin
96
- git commit -m "Release macpm 3.0: Linux backend and the GPU view"
97
- git tag -a v3.0 -m "macpm 3.0"
96
+ git commit -m "Release macpm 3.0.2: dashing 0.2 colour compatibility"
97
+ git tag -a v3.0.2 -m "macpm 3.0.2"
98
98
  git push origin main
99
- git push origin v3.0
99
+ git push origin v3.0.2
100
100
  ```
101
101
 
102
102
  The `Release` workflow builds the sdist/wheel, checks metadata and attaches
@@ -120,7 +120,7 @@ PYTHON=python3 packaging/build.sh
120
120
  This produces:
121
121
 
122
122
  ```text
123
- dist/macpm-3.0-macos-arm64.tar.gz
123
+ dist/macpm-3.0.2-macos-arm64.tar.gz
124
124
  ```
125
125
 
126
126
  Attach it to the GitHub release. The binaries are ad-hoc signed, not
@@ -1,6 +1,6 @@
1
1
  # macpm → Linux(x86_64 / arm64)移植可行性评估
2
2
 
3
- 评估对象:macpm v3.0(本仓库,约 4.3k 行核心代码 + 1.1k 行测试)。
3
+ 评估对象:macpm v3.0.2(本仓库,约 4.3k 行核心代码 + 1.1k 行测试)。
4
4
 
5
5
  > **实现状态(2026-11-14):已落地。** 平台抽象层(`macpm/backend.py`)、Linux 后端
6
6
  > (`macpm/linux_backend/`)与 UI 能力适配已完成,`python -m unittest discover -s tests`
@@ -1,3 +1,3 @@
1
1
  """macpm: rootless performance monitor for Apple Silicon."""
2
2
 
3
- __version__ = "3.0"
3
+ __version__ = "3.0.2"
@@ -5,6 +5,7 @@ import os
5
5
  import time
6
6
  from collections import deque
7
7
 
8
+ import dashing
8
9
  import humanize
9
10
  import psutil
10
11
  from blessed import Terminal
@@ -19,7 +20,57 @@ from .gpuview import GpuView
19
20
  from .sensors import SensorReader
20
21
  from .tui import RESET_FG, _bottom, _pad, footer
21
22
 
22
- version = 'macpm v3.0'
23
+ version = 'macpm v3.0.2'
24
+
25
+ # dashing 0.2 turned colours into RGB objects behind read-only properties and
26
+ # added ``Tile.set_color``; 0.1 used plain attributes and integer ANSI colours.
27
+ _DASHING_V2 = hasattr(Tile, "set_color")
28
+ _ANSI_RGB = (
29
+ (0, 0, 0),
30
+ (255, 0, 0),
31
+ (0, 255, 0),
32
+ (255, 255, 0),
33
+ (0, 0, 255),
34
+ (255, 0, 255),
35
+ (0, 255, 255),
36
+ (255, 255, 255),
37
+ )
38
+
39
+
40
+ def _dash_color(value):
41
+ """Translate a macpm ANSI colour index for the installed dashing."""
42
+ if not _DASHING_V2 or not isinstance(value, int):
43
+ return value
44
+ rgb = getattr(dashing, "RGB", None)
45
+ if rgb is None:
46
+ return value
47
+ if 0 <= value < len(_ANSI_RGB):
48
+ return rgb(*_ANSI_RGB[value])
49
+ if value == 8: # bright black / grey, the eighth theme
50
+ return rgb(128, 128, 128)
51
+ return value
52
+
53
+
54
+ def _set_tile_color(tile, name, value):
55
+ """Set ``color``/``border_color`` on a dashing tile across versions."""
56
+ if tile is None:
57
+ return
58
+ setter = getattr(tile, "set_color", None)
59
+ if callable(setter):
60
+ try:
61
+ setter("text_color" if name == "color" else name, _dash_color(value))
62
+ return
63
+ except (TypeError, ValueError):
64
+ pass
65
+ try:
66
+ setattr(tile, name, value)
67
+ except AttributeError:
68
+ pass
69
+
70
+
71
+ def _set_tile_colors(tile, value):
72
+ _set_tile_color(tile, "color", value)
73
+ _set_tile_color(tile, "border_color", value)
23
74
  _DEFAULT_FOOTER = footer("q quit 1-5 view ←/→ colour Ctrl+R reset peaks")
24
75
 
25
76
 
@@ -311,6 +362,7 @@ class DefaultView():
311
362
  def __init__(self, soc_info_dict, args, netinfo=None, capabilities=None):
312
363
  self.netinfo = netinfo
313
364
  self.caps = capabilities or MACOS_CAPABILITIES
365
+ self._applied_color = args.color
314
366
  self._term = None
315
367
  self.cpu_peak_power = 0
316
368
  self.gpu_peak_power = 0
@@ -337,18 +389,18 @@ class DefaultView():
337
389
  self.power_panel = caps.power_panel
338
390
 
339
391
  self.cpu1_gauge = (
340
- HGauge(title="E-CPU Usage", val=0, color=args.color) if self.has_e else None
392
+ HGauge(title="E-CPU Usage", val=0, color=_dash_color(args.color)) if self.has_e else None
341
393
  )
342
394
  self.cpu2_gauge = HGauge(
343
395
  title="P-CPU Usage" if self.has_e else "CPU Usage",
344
396
  val=0,
345
- color=args.color,
397
+ color=_dash_color(args.color),
346
398
  )
347
399
  self.gpu_gauge = (
348
- HGauge(title="GPU Usage", val=0, color=args.color) if self.has_gpu else None
400
+ HGauge(title="GPU Usage", val=0, color=_dash_color(args.color)) if self.has_gpu else None
349
401
  )
350
402
  self.ane_gauge = (
351
- HGauge(title="ANE", val=0, color=args.color) if self.has_ane else None
403
+ HGauge(title="ANE", val=0, color=_dash_color(args.color)) if self.has_ane else None
352
404
  )
353
405
  self.gpu_ane_gauges = [
354
406
  gauge for gauge in (self.gpu_gauge, self.ane_gauge) if gauge is not None
@@ -356,7 +408,7 @@ class DefaultView():
356
408
 
357
409
  self.e_core_gauges = (
358
410
  [
359
- VGauge(val=0, color=args.color, border_color=args.color)
411
+ VGauge(val=0, color=_dash_color(args.color), border_color=_dash_color(args.color))
360
412
  for _ in range(self.e_core_count)
361
413
  ]
362
414
  if self.has_e
@@ -384,7 +436,7 @@ class DefaultView():
384
436
  )
385
437
  self.p_core_gauges[i].extend(
386
438
  [
387
- VGauge(val=0, color=args.color, border_color=args.color)
439
+ VGauge(val=0, color=_dash_color(args.color), border_color=_dash_color(args.color))
388
440
  for _ in range(width)
389
441
  ]
390
442
  )
@@ -409,50 +461,50 @@ class DefaultView():
409
461
  self.processor_split = VSplit(
410
462
  *self.processor_gauges,
411
463
  title="Processor Utilization",
412
- border_color=args.color,
464
+ border_color=_dash_color(args.color),
413
465
  )
414
466
 
415
- self.ram_gauge = HGauge(title="RAM Usage", val=0, color=args.color)
467
+ self.ram_gauge = HGauge(title="RAM Usage", val=0, color=_dash_color(args.color))
416
468
  self.memory_gauges = VSplit(
417
469
  self.ram_gauge,
418
- border_color=args.color,
470
+ border_color=_dash_color(args.color),
419
471
  title="Memory",
420
472
  )
421
473
 
422
474
  self.sensor_panel = SensorPanel(
423
- color=args.color,
475
+ color=_dash_color(args.color),
424
476
  title="Temps & Fans",
425
- border_color=args.color,
477
+ border_color=_dash_color(args.color),
426
478
  )
427
479
 
428
480
  self.cpu_power_chart = None
429
481
  self.gpu_power_chart = None
430
482
  self.power_charts = None
431
483
  if self.power_panel:
432
- self.cpu_power_chart = HChart(title="CPU Power", color=args.color)
433
- self.gpu_power_chart = HChart(title="GPU Power", color=args.color)
484
+ self.cpu_power_chart = HChart(title="CPU Power", color=_dash_color(args.color))
485
+ self.gpu_power_chart = HChart(title="GPU Power", color=_dash_color(args.color))
434
486
  self.power_charts = (
435
487
  VSplit(
436
488
  self.cpu_power_chart,
437
489
  self.gpu_power_chart,
438
490
  title="Power Chart",
439
- border_color=args.color,
491
+ border_color=_dash_color(args.color),
440
492
  )
441
493
  if args.show_cores
442
494
  else HSplit(
443
495
  self.cpu_power_chart,
444
496
  self.gpu_power_chart,
445
497
  title="Power Chart",
446
- border_color=args.color,
498
+ border_color=_dash_color(args.color),
447
499
  )
448
500
  )
449
501
 
450
- self.disk_read_iops_charts = HChart(title="read iops", color=args.color)
451
- self.disk_write_iops_charts = HChart(title="write iops", color=args.color)
452
- self.disk_read_bps_charts = HChart(title="read Bps", color=args.color)
453
- self.disk_write_bps_charts = HChart(title="write Bps", color=args.color)
454
- self.network_in_bps_charts = HChart(title="in Bps", color=args.color)
455
- self.network_out_bps_charts = HChart(title="out Bps", color=args.color)
502
+ self.disk_read_iops_charts = HChart(title="read iops", color=_dash_color(args.color))
503
+ self.disk_write_iops_charts = HChart(title="write iops", color=_dash_color(args.color))
504
+ self.disk_read_bps_charts = HChart(title="read Bps", color=_dash_color(args.color))
505
+ self.disk_write_bps_charts = HChart(title="write Bps", color=_dash_color(args.color))
506
+ self.network_in_bps_charts = HChart(title="in Bps", color=_dash_color(args.color))
507
+ self.network_out_bps_charts = HChart(title="out Bps", color=_dash_color(args.color))
456
508
  self.disk_io_charts = HSplit(
457
509
  VSplit(
458
510
  self.disk_read_iops_charts,
@@ -463,16 +515,16 @@ class DefaultView():
463
515
  self.disk_write_bps_charts,
464
516
  ),
465
517
  title="Disk IO",
466
- color=args.color,
467
- border_color=args.color,
518
+ color=_dash_color(args.color),
519
+ border_color=_dash_color(args.color),
468
520
  )
469
521
 
470
522
  self.network_io_charts = HSplit(
471
523
  self.network_in_bps_charts,
472
524
  self.network_out_bps_charts,
473
525
  title="Network IO",
474
- color=args.color,
475
- border_color=args.color,
526
+ color=_dash_color(args.color),
527
+ border_color=_dash_color(args.color),
476
528
  )
477
529
 
478
530
  tail = []
@@ -582,7 +634,8 @@ class DefaultView():
582
634
  if sensors is not None:
583
635
  self.sensor_panel.lines = sensors.lines()
584
636
  self.sensor_panel.levels = sensors.fan_levels()
585
- if args.color != self.processor_split.border_color:
637
+ if args.color != self._applied_color:
638
+ self._applied_color = args.color
586
639
  clear_console()
587
640
  for gauge in (
588
641
  self.cpu1_gauge,
@@ -590,35 +643,28 @@ class DefaultView():
590
643
  self.gpu_gauge,
591
644
  self.ane_gauge,
592
645
  ):
593
- if gauge is not None:
594
- gauge.color = args.color
646
+ _set_tile_color(gauge, "color", args.color)
595
647
  if self.power_charts is not None:
596
- self.power_charts.color = args.color
597
- self.power_charts.border_color = args.color
598
- self.cpu_power_chart.color = args.color
599
- self.gpu_power_chart.color = args.color
600
- self.processor_split.border_color = args.color
601
- self.ram_gauge.color = args.color
602
- self.memory_gauges.border_color = args.color
603
- self.sensor_panel.color = args.color
604
- self.sensor_panel.border_color = args.color
605
- self.disk_io_charts.color = args.color
606
- self.disk_io_charts.border_color = args.color
607
- self.network_io_charts.color = args.color
608
- self.network_io_charts.border_color = args.color
609
- self.disk_read_iops_charts.color = args.color
610
- self.disk_write_iops_charts.color = args.color
611
- self.disk_read_bps_charts.color = args.color
612
- self.disk_write_bps_charts.color = args.color
613
- self.network_in_bps_charts.color = args.color
614
- self.network_out_bps_charts.color = args.color
615
- for i in range(len(self.e_core_gauges)):
616
- self.e_core_gauges[i].color = args.color
617
- self.e_core_gauges[i].border_color = args.color
618
- for i in range(len(self.p_core_gauges)):
619
- for j in range(len(self.p_core_gauges[i])):
620
- self.p_core_gauges[i][j].color = args.color
621
- self.p_core_gauges[i][j].border_color = args.color
648
+ _set_tile_colors(self.power_charts, args.color)
649
+ _set_tile_color(self.cpu_power_chart, "color", args.color)
650
+ _set_tile_color(self.gpu_power_chart, "color", args.color)
651
+ _set_tile_color(self.processor_split, "border_color", args.color)
652
+ _set_tile_color(self.ram_gauge, "color", args.color)
653
+ _set_tile_color(self.memory_gauges, "border_color", args.color)
654
+ _set_tile_colors(self.sensor_panel, args.color)
655
+ _set_tile_colors(self.disk_io_charts, args.color)
656
+ _set_tile_colors(self.network_io_charts, args.color)
657
+ _set_tile_color(self.disk_read_iops_charts, "color", args.color)
658
+ _set_tile_color(self.disk_write_iops_charts, "color", args.color)
659
+ _set_tile_color(self.disk_read_bps_charts, "color", args.color)
660
+ _set_tile_color(self.disk_write_bps_charts, "color", args.color)
661
+ _set_tile_color(self.network_in_bps_charts, "color", args.color)
662
+ _set_tile_color(self.network_out_bps_charts, "color", args.color)
663
+ for gauge in self.e_core_gauges:
664
+ _set_tile_colors(gauge, args.color)
665
+ for row in self.p_core_gauges:
666
+ for gauge in row:
667
+ _set_tile_colors(gauge, args.color)
622
668
  if not update:
623
669
  self.ui.display()
624
670
  self._draw_extras(args)
@@ -1279,6 +1325,12 @@ def begin(stdscr, sampler):
1279
1325
 
1280
1326
 
1281
1327
  def main():
1328
+ if _DASHING_V2:
1329
+ raise SystemExit(
1330
+ "macpm needs dashing < 0.2: dashing 0.2 changed the drawing API "
1331
+ "that macpm's custom layout relies on.\n"
1332
+ "Fix it with: python3 -m pip install 'dashing<0.2'"
1333
+ )
1282
1334
  linux = platform_name() == "linux"
1283
1335
  if linux:
1284
1336
  print(f"\n{version} - performance monitoring CLI for Linux")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macpm
3
- Version: 3.0
3
+ Version: 3.0.2
4
4
  Summary: Performance monitoring CLI for Apple Silicon and Linux
5
5
  Home-page: https://github.com/visualcjy/macpm
6
6
  Author: Jinyu Chen
@@ -23,7 +23,7 @@ Classifier: Topic :: System :: Monitoring
23
23
  Requires-Python: >=3.9
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
- Requires-Dist: dashing>=0.1
26
+ Requires-Dist: dashing<0.2,>=0.1
27
27
  Requires-Dist: psutil>=5.9
28
28
  Requires-Dist: humanize>=4.0
29
29
  Dynamic: author
@@ -314,7 +314,7 @@ shows it as a `MODEL` column.
314
314
 
315
315
  A single-GPU machine keeps the older layout: card summary on top, process table
316
316
  below. Every view's footer starts with the app name and version
317
- (`macpm v3.0 · q quit …`).
317
+ (`macpm v3.0.2 · q quit …`).
318
318
 
319
319
  ```text
320
320
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -328,7 +328,7 @@ below. Every view's footer starts with the app name and version
328
328
  │ └ 222 Xorg 2.0G │
329
329
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
330
330
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
331
- └ macpm v3.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
331
+ └ macpm v3.0.2 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
332
332
  ```
333
333
 
334
334
  | Platform | What fills each row |
@@ -580,6 +580,14 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
580
580
  - **The network header has no public IP** — the lookup is disabled with
581
581
  `--no-public-ip`, or the machine is offline / the service is blocked. The
582
582
  local IP, prefix and gateway still show.
583
+ - **`ModuleNotFoundError: No module named 'macpm.macpm'` after a root install**
584
+ — `sudo pip install` inherited a restrictive umask (e.g. `0007`), so the
585
+ package directories were written as `root:root 750` and a normal user cannot
586
+ read them; Python then treats them as namespace packages (the same happens to
587
+ `blessed`, which reports `cannot import name 'Terminal'`). Reinstall with a
588
+ sane umask (`sudo sh -c 'umask 022; pip install --force-reinstall macpm'`),
589
+ install with `pip install --user`, or fix the modes (`sudo chmod -R a+rX
590
+ /usr/local/lib/python3.*/dist-packages/macpm*` and the dependencies).
583
591
 
584
592
  ## Changelog
585
593
 
@@ -55,6 +55,7 @@ tests/__init__.py
55
55
  tests/linux_fixtures.py
56
56
  tests/test_calc_freq.py
57
57
  tests/test_cli.py
58
+ tests/test_dashing_compat.py
58
59
  tests/test_gpuview.py
59
60
  tests/test_layout.py
60
61
  tests/test_linux_cpu.py
@@ -1,3 +1,3 @@
1
- dashing>=0.1
1
+ dashing<0.2,>=0.1
2
2
  psutil>=5.9
3
3
  humanize>=4.0
@@ -7,7 +7,7 @@ README = (ROOT / "README.md").read_text(encoding="utf-8")
7
7
 
8
8
  setup(
9
9
  name="macpm",
10
- version="3.0",
10
+ version="3.0.2",
11
11
  author="Jinyu Chen",
12
12
  author_email="visualcjy@mail.com",
13
13
  url="https://github.com/visualcjy/macpm",
@@ -25,7 +25,7 @@ setup(
25
25
  include_package_data=True,
26
26
  python_requires=">=3.9",
27
27
  install_requires=[
28
- "dashing>=0.1",
28
+ "dashing>=0.1,<0.2",
29
29
  "psutil>=5.9",
30
30
  "humanize>=4.0",
31
31
  ],
@@ -25,7 +25,7 @@ class CliTests(unittest.TestCase):
25
25
  def test_version(self):
26
26
  result = self.run_module("--version")
27
27
  self.assertEqual(result.returncode, 0, result.stderr)
28
- self.assertIn("macpm v3.0", result.stdout)
28
+ self.assertIn("macpm v3.0.2", result.stdout)
29
29
 
30
30
  def test_help(self):
31
31
  result = self.run_module("--help")
@@ -0,0 +1,113 @@
1
+ """dashing 0.1 vs 0.2 colour compatibility.
2
+
3
+ 0.1 stored colours as plain attributes; 0.2 turned them into read-only
4
+ properties backed by ``Tile.set_color``, which only accepts RGB/strings.
5
+ """
6
+
7
+ import sys
8
+ import unittest
9
+ from unittest import mock
10
+
11
+ # macpm.macpm parses the command line at import time (the TUI reads a global).
12
+ with mock.patch.object(sys, "argv", ["macpm"]):
13
+ import macpm.macpm as macpm_mod
14
+
15
+
16
+ class FakeRGB:
17
+ def __init__(self, r, g, b):
18
+ self.r = r
19
+ self.g = g
20
+ self.b = b
21
+
22
+ def __repr__(self):
23
+ return f"RGB({self.r},{self.g},{self.b})"
24
+
25
+
26
+ class LegacyTile:
27
+ def __init__(self):
28
+ self.color = None
29
+ self.border_color = None
30
+
31
+
32
+ class ModernTile:
33
+ def __init__(self):
34
+ self._text_color = None
35
+ self._border_color = None
36
+ self.calls = []
37
+
38
+ @property
39
+ def border_color(self):
40
+ return self._border_color
41
+
42
+ def set_color(self, name, value):
43
+ if not isinstance(value, FakeRGB):
44
+ raise ValueError("Invalid color type")
45
+ setattr(self, "_" + name, value)
46
+ self.calls.append(name)
47
+
48
+
49
+ class DashingCompatTests(unittest.TestCase):
50
+ def setUp(self):
51
+ self._v2 = macpm_mod._DASHING_V2
52
+ self._rgb = getattr(macpm_mod.dashing, "RGB", None)
53
+
54
+ def tearDown(self):
55
+ macpm_mod._DASHING_V2 = self._v2
56
+ try:
57
+ if self._rgb is None:
58
+ del macpm_mod.dashing.RGB
59
+ else:
60
+ macpm_mod.dashing.RGB = self._rgb
61
+ except AttributeError:
62
+ pass
63
+
64
+ def test_legacy_tiles_keep_plain_attributes(self):
65
+ macpm_mod._DASHING_V2 = False
66
+ tile = LegacyTile()
67
+
68
+ macpm_mod._set_tile_colors(tile, 3)
69
+
70
+ self.assertEqual(tile.color, 3)
71
+ self.assertEqual(tile.border_color, 3)
72
+
73
+ def test_modern_tiles_use_set_color_with_rgb(self):
74
+ macpm_mod._DASHING_V2 = True
75
+ macpm_mod.dashing.RGB = FakeRGB
76
+ tile = ModernTile()
77
+
78
+ macpm_mod._set_tile_colors(tile, 3)
79
+
80
+ self.assertEqual(tile.calls, ["text_color", "border_color"])
81
+ self.assertEqual((tile._text_color.r, tile._text_color.g, tile._text_color.b),
82
+ (255, 255, 0))
83
+
84
+ def test_theme_eight_maps_to_grey(self):
85
+ macpm_mod._DASHING_V2 = True
86
+ macpm_mod.dashing.RGB = FakeRGB
87
+ tile = ModernTile()
88
+
89
+ macpm_mod._set_tile_color(tile, "border_color", 8)
90
+
91
+ self.assertEqual((tile._border_color.r, tile._border_color.g,
92
+ tile._border_color.b), (128, 128, 128))
93
+
94
+ def test_unknown_tiles_are_ignored(self):
95
+ macpm_mod._DASHING_V2 = True
96
+ macpm_mod.dashing.RGB = FakeRGB
97
+
98
+ macpm_mod._set_tile_color(object(), "color", 2) # must not raise
99
+
100
+
101
+ if __name__ == "__main__":
102
+ unittest.main()
103
+
104
+
105
+ class DashingGuardTests(unittest.TestCase):
106
+ def test_main_refuses_dashing_two_with_an_actionable_message(self):
107
+ with mock.patch.object(macpm_mod, "_DASHING_V2", True):
108
+ with self.assertRaises(SystemExit) as caught:
109
+ macpm_mod.main()
110
+
111
+ message = str(caught.exception)
112
+ self.assertIn("dashing", message)
113
+ self.assertIn("dashing<0.2", message)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes