speedpulse 0.1.3__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 (40) hide show
  1. speedpulse-0.1.3/.gitignore +36 -0
  2. speedpulse-0.1.3/CHANGELOG.md +97 -0
  3. speedpulse-0.1.3/LICENSE +21 -0
  4. speedpulse-0.1.3/PKG-INFO +153 -0
  5. speedpulse-0.1.3/README.md +110 -0
  6. speedpulse-0.1.3/pyproject.toml +112 -0
  7. speedpulse-0.1.3/src/speedpulse/__init__.py +4 -0
  8. speedpulse-0.1.3/src/speedpulse/__main__.py +10 -0
  9. speedpulse-0.1.3/src/speedpulse/app.py +98 -0
  10. speedpulse-0.1.3/src/speedpulse/core/__init__.py +5 -0
  11. speedpulse-0.1.3/src/speedpulse/core/autostart.py +257 -0
  12. speedpulse-0.1.3/src/speedpulse/core/config.py +262 -0
  13. speedpulse-0.1.3/src/speedpulse/core/interfaces.py +131 -0
  14. speedpulse-0.1.3/src/speedpulse/core/rates.py +61 -0
  15. speedpulse-0.1.3/src/speedpulse/core/sampler.py +136 -0
  16. speedpulse-0.1.3/src/speedpulse/core/singleinstance.py +123 -0
  17. speedpulse-0.1.3/src/speedpulse/core/units.py +121 -0
  18. speedpulse-0.1.3/src/speedpulse/py.typed +0 -0
  19. speedpulse-0.1.3/src/speedpulse/ui/__init__.py +1 -0
  20. speedpulse-0.1.3/src/speedpulse/ui/app_icon.py +66 -0
  21. speedpulse-0.1.3/src/speedpulse/ui/floating_widget.py +117 -0
  22. speedpulse-0.1.3/src/speedpulse/ui/icon_renderer.py +237 -0
  23. speedpulse-0.1.3/src/speedpulse/ui/notifications.py +18 -0
  24. speedpulse-0.1.3/src/speedpulse/ui/panel_text.py +354 -0
  25. speedpulse-0.1.3/src/speedpulse/ui/settings_dialog.py +313 -0
  26. speedpulse-0.1.3/src/speedpulse/ui/sni.py +760 -0
  27. speedpulse-0.1.3/src/speedpulse/ui/tray.py +469 -0
  28. speedpulse-0.1.3/tests/conftest.py +5 -0
  29. speedpulse-0.1.3/tests/gui/test_icon_renderer.py +123 -0
  30. speedpulse-0.1.3/tests/gui/test_sni.py +327 -0
  31. speedpulse-0.1.3/tests/gui/test_sni_bus.py +216 -0
  32. speedpulse-0.1.3/tests/gui/test_tray_smoke.py +386 -0
  33. speedpulse-0.1.3/tests/test_autostart.py +122 -0
  34. speedpulse-0.1.3/tests/test_config.py +152 -0
  35. speedpulse-0.1.3/tests/test_glibc_floor.py +129 -0
  36. speedpulse-0.1.3/tests/test_interfaces.py +132 -0
  37. speedpulse-0.1.3/tests/test_rates.py +61 -0
  38. speedpulse-0.1.3/tests/test_sampler.py +168 -0
  39. speedpulse-0.1.3/tests/test_singleinstance.py +39 -0
  40. speedpulse-0.1.3/tests/test_units.py +127 -0
@@ -0,0 +1,36 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+
11
+ # Tooling caches
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ .mypy_cache/
15
+ .coverage
16
+ coverage.xml
17
+ htmlcov/
18
+
19
+ # Packaging artifacts (our hand-maintained spec lives in packaging/)
20
+ *.deb
21
+ *.rpm
22
+ *.AppImage
23
+ *.exe
24
+ *.dmg
25
+ *.app/
26
+ icon.py
27
+
28
+ # Editors / OS
29
+ .idea/
30
+ .vscode/
31
+ *.swp
32
+ .DS_Store
33
+ Thumbs.db
34
+
35
+ # Local dev
36
+ *.log
@@ -0,0 +1,97 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.3] - 2026-11-28
9
+
10
+ ### Fixed
11
+
12
+ - **The Linux `.deb` did not start on Ubuntu 24.04 or 25.x, nor on Debian 13.**
13
+ Every release so far was built on GitHub's `ubuntu-latest` image, which
14
+ had moved on to Ubuntu 26.04. Libraries bundled from there (glib, lcms2)
15
+ required glibc 2.43, while Ubuntu 24.04 has 2.39 — and because the package
16
+ only declared `libc6 (>= 2.38)`, it installed cleanly and then failed at
17
+ launch. The build is now pinned to Ubuntu 24.04, the oldest supported
18
+ release; a new check refuses to release a bundle that needs a newer glibc;
19
+ and the `.deb` declares the glibc version its contents really need.
20
+
21
+ ## [0.1.2] - 2026-11-28
22
+
23
+ ### Added
24
+
25
+ - **GNOME panel text**: on GNOME Shell (Ubuntu's default desktop) the rates
26
+ are now drawn by the panel itself next to the icon, in the system font —
27
+ the same size as the battery percentage, following the system text-size
28
+ setting. The panel gives every tray icon a fixed 16x16 px square, which no
29
+ icon layout can fill with legible text, so SpeedPulse now serves its own
30
+ StatusNotifierItem (text label, icon and menu) over D-Bus instead of
31
+ Qt's icon-only one. Settings → *Show rates as panel text* switches back to
32
+ an icon without text.
33
+ - New dependency on Linux only: `jeepney` (pure Python, MIT) for that D-Bus
34
+ service. `SPEEDPULSE_TRAY=qt` forces Qt's generic tray icon in case the
35
+ indicator ever misbehaves.
36
+
37
+ ### Changed
38
+
39
+ - Tray labels are fitted to their drawn glyphs rather than to the font's
40
+ line boxes, in both layouts, so the digits are markedly larger in the
41
+ same space. The two-line layout shows the bare numbers — download in
42
+ green over upload in blue, the colours of the app icon's arrows.
43
+ - On GNOME the icon-only style is rendered at the tray slot's true pixel
44
+ size, which keeps it crisp on fractional display scales.
45
+ - The app reports the released version in `--version` and the About box
46
+ (it said 0.1.0).
47
+
48
+ ### Fixed
49
+
50
+ - Tray text overflowed its icon at 2x text size on HiDPI displays: the fit
51
+ loop stepped down one pixel at a time and gave up before finding a size
52
+ that fit.
53
+
54
+ ## [0.1.1] - 2026-11-15
55
+
56
+ ### Fixed
57
+
58
+ - The bundled Qt xcb platform plugin requires the xcb-util library family
59
+ at runtime; PyInstaller does not bundle them and the deb did not declare
60
+ them all, so the app could fail to start on X11 sessions on minimal
61
+ systems. The deb now declares the complete set, CI bundles it, and a new
62
+ X11 boot smoke test guards it.
63
+ - macOS bundle ships the SpeedPulse icon (.icns) and version metadata.
64
+
65
+ ## [0.1.0] - 2026-11-15
66
+
67
+ ### Added
68
+
69
+ - **Floating widget**: draggable, resizable, always-on-top desktop display
70
+ with large green/blue rates — for panels whose tray slot is too small to
71
+ hold legible tray text. Enable from the tray menu or Settings; position
72
+ and size are remembered.
73
+ - **Tray layout & text size options**: choose between two-line (square) and
74
+ side-by-side (wide, text-width-sized) tray text, and scale the tray text
75
+ size from 0.6x to 2x in Settings.
76
+ - Live download/upload throughput in the system tray, sampled from OS
77
+ interface counters with suspend/resume and counter-reset guards.
78
+ - Per-interface selection with automatic filtering of loopback and virtual
79
+ interfaces (docker, bridges, veth, VMware/VirtualBox); VPN tunnels opt-in.
80
+ - Bits-per-second or bytes-per-second display, decimal or 1024-based units.
81
+ - Tray text rendered with a contrasting outline for legibility on light and
82
+ dark panels; HiDPI-aware rendering.
83
+ - Settings dialog: units, update interval, interface selection, tray text
84
+ colour, launch-at-login.
85
+ - Launch-at-login support: XDG autostart (Linux), HKCU Run key (Windows),
86
+ LaunchAgent plist (macOS, App-Translocation-safe).
87
+ - Single-instance enforcement via OS-level advisory file locks.
88
+ - Configuration as TOML with safe defaults, clamping and forward-compatible
89
+ parsing; corrupt or partial config files never crash the app.
90
+ - Test suite: pure-core unit tests plus offscreen GUI smoke tests; CI across
91
+ Linux/Windows/macOS on Python 3.11–3.14 with ruff and pyright gates.
92
+
93
+ [Unreleased]: https://github.com/rafi138/speedpulse/compare/v0.1.3...HEAD
94
+ [0.1.3]: https://github.com/rafi138/speedpulse/compare/v0.1.2...v0.1.3
95
+ [0.1.2]: https://github.com/rafi138/speedpulse/compare/v0.1.1...v0.1.2
96
+ [0.1.1]: https://github.com/rafi138/speedpulse/compare/v0.1.0...v0.1.1
97
+ [0.1.0]: https://github.com/rafi138/speedpulse/releases/tag/v0.1.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpeedPulse contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,153 @@
1
+ Metadata-Version: 2.5
2
+ Name: speedpulse
3
+ Version: 0.1.3
4
+ Summary: Cross-platform internet speed monitor for your system tray: live throughput plus on-demand speed tests.
5
+ Project-URL: Homepage, https://github.com/rafi138/speedpulse
6
+ Project-URL: Issues, https://github.com/rafi138/speedpulse/issues
7
+ Project-URL: Changelog, https://github.com/rafi138/speedpulse/blob/main/CHANGELOG.md
8
+ Author: SpeedPulse contributors
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: bandwidth,monitor,network,speed,speedtest,tray
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: MacOS X
14
+ Classifier: Environment :: Win32 (MS Windows)
15
+ Classifier: Environment :: X11 Applications
16
+ Classifier: Intended Audience :: End Users/Desktop
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
+ Classifier: Topic :: System :: Monitoring
27
+ Classifier: Topic :: System :: Networking :: Monitoring
28
+ Requires-Python: >=3.11
29
+ Requires-Dist: jeepney>=0.8; sys_platform == 'linux'
30
+ Requires-Dist: psutil>=5.9.0
31
+ Requires-Dist: pyside6<7.0,>=6.8.0
32
+ Provides-Extra: build
33
+ Requires-Dist: pillow>=10.0; extra == 'build'
34
+ Requires-Dist: pyinstaller>=6.10; extra == 'build'
35
+ Provides-Extra: dev
36
+ Requires-Dist: pre-commit>=3.7; extra == 'dev'
37
+ Requires-Dist: pyright==1.1.414; extra == 'dev'
38
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
39
+ Requires-Dist: pytest-qt>=4.4; extra == 'dev'
40
+ Requires-Dist: pytest>=8.0; extra == 'dev'
41
+ Requires-Dist: ruff==0.17.5; extra == 'dev'
42
+ Description-Content-Type: text/markdown
43
+
44
+ # SpeedPulse
45
+
46
+ > The pulse of your connection, in your tray. Live network throughput for
47
+ > Windows, macOS and Linux — with speed tests on the way.
48
+
49
+ **Status: early development (v0.1).** SpeedPulse lives in your system tray
50
+ and shows your real-time download/upload throughput, measured from the OS's
51
+ interface counters — no external servers involved.
52
+
53
+ ## Features (v0.1)
54
+
55
+ - **Live throughput** — aggregate down/up rates updated every second
56
+ - **GNOME panel text** — on Ubuntu/GNOME the panel itself draws the rates
57
+ next to the icon in the system font, the same size as the battery
58
+ percentage
59
+ - **Floating widget** — a large, draggable, always-on-top desktop display
60
+ for when the tray slot is too small; resizable, position remembered
61
+ - **Adjustable tray text** — two-line (square) or side-by-side (wide)
62
+ layout, 0.6x–2x text size
63
+ - **Per-interface control** — physical interfaces by default; virtual
64
+ interfaces (docker, bridges, loopback) filtered out; VPN tunnels opt-in
65
+ - **Bits or bytes** — Mbps or MB/s, decimal or 1024-based units
66
+ - **Dark & light panels** — outlined tray text that stays legible anywhere
67
+ - **Launch at startup** — app-managed autostart, no installer tricks
68
+ - **Single instance** — starting it twice just focuses the running app
69
+ - **Settings that persist** — plain TOML in your config directory
70
+
71
+ ## Roadmap
72
+
73
+ | Release | Scope |
74
+ |---|---|
75
+ | v0.1 (in progress) | Live throughput tray app |
76
+ | v0.2 | Speed tests: built-in HTTP backend, optional Ookla CLI integration (never bundled), LibreSpeed for self-hosters; scheduled + on-demand |
77
+ | v0.3 | History with graphs, data-usage totals, data-cap alerts, CSV/JSON export |
78
+ | v1.0 | Polished installers: `.deb`, Windows installer + portable, macOS dmg — all built by CI from a git tag |
79
+
80
+ ## Install
81
+
82
+ **PyPI** (once a version has been published — check the
83
+ [project page](https://pypi.org/project/speedpulse/)):
84
+
85
+ ```bash
86
+ pip install speedpulse # or: pipx install speedpulse
87
+ ```
88
+
89
+ **From the GitHub releases** (preferred for end users): grab the `.deb`,
90
+ Windows installer/portable, or macOS dmg from the
91
+ [releases page](https://github.com/rafi138/speedpulse/releases).
92
+
93
+ **From source:**
94
+
95
+ ```bash
96
+ git clone https://github.com/rafi138/speedpulse
97
+ cd speedpulse
98
+ python -m venv .venv && source .venv/bin/activate
99
+ pip install -e .
100
+ speedpulse
101
+ ```
102
+
103
+ - **GNOME/Ubuntu**: needs the *AppIndicator and KStatusNotifierItem Support*
104
+ extension (pre-installed on Ubuntu). GNOME gives every tray icon a fixed
105
+ 16×16 px square — too small for legible text — so there SpeedPulse shows
106
+ the rates as **panel text** next to its icon instead: drawn by GNOME in
107
+ the system font, the same size as the battery percentage.
108
+ - **KDE, Xfce, Cinnamon, MATE** and most other Linux desktops show tray
109
+ icons natively.
110
+ - Windows/macOS: no extra requirements.
111
+
112
+ ## Platform notes
113
+
114
+ - **GNOME without the AppIndicator extension**: GNOME Shell has no tray of
115
+ its own, so nothing can show a tray icon. SpeedPulse detects this and logs
116
+ a hint (`speedpulse -v`).
117
+ - **Icon-only on GNOME**: Settings → *Show rates as panel text* switches the
118
+ indicator back to an icon without text, like on other desktops.
119
+ - **Classic tray icon on GNOME**: `SPEEDPULSE_TRAY=qt speedpulse` bypasses
120
+ the panel-text indicator and uses Qt's generic tray icon — the escape
121
+ hatch should the indicator ever misbehave.
122
+ - **Tray text too small elsewhere**: try Settings → *Tray layout* and *Tray
123
+ text size*, or enable the *floating widget*.
124
+ - **Unsigned builds**: until code signing is set up, Windows may show a
125
+ SmartScreen prompt and macOS Gatekeeper requires *System Settings →
126
+ Privacy & Security → Open Anyway* on first launch.
127
+
128
+ ## Development
129
+
130
+ ```bash
131
+ pip install -e ".[dev]"
132
+ pre-commit install
133
+ pytest # pure-core tests + offscreen GUI smoke tests
134
+ ruff check . && ruff format --check .
135
+ pyright src tests
136
+ ```
137
+
138
+ On Linux the tests also need `dbus-daemon`: the GNOME panel-text indicator
139
+ is exercised against a private session bus.
140
+
141
+ The codebase is strictly split: `src/speedpulse/core/` is pure Python
142
+ (headless-testable, no GUI imports); `src/speedpulse/ui/` is a thin Qt
143
+ adapter layer. See [PLAN.md](PLAN.md) for the full architecture and roadmap.
144
+
145
+ ## Contributing
146
+
147
+ Contributions are welcome — please open an issue first for anything beyond
148
+ small fixes. PRs are reviewed by the maintainer before merging; see
149
+ [CONTRIBUTING.md](CONTRIBUTING.md).
150
+
151
+ ## License
152
+
153
+ [MIT](LICENSE)
@@ -0,0 +1,110 @@
1
+ # SpeedPulse
2
+
3
+ > The pulse of your connection, in your tray. Live network throughput for
4
+ > Windows, macOS and Linux — with speed tests on the way.
5
+
6
+ **Status: early development (v0.1).** SpeedPulse lives in your system tray
7
+ and shows your real-time download/upload throughput, measured from the OS's
8
+ interface counters — no external servers involved.
9
+
10
+ ## Features (v0.1)
11
+
12
+ - **Live throughput** — aggregate down/up rates updated every second
13
+ - **GNOME panel text** — on Ubuntu/GNOME the panel itself draws the rates
14
+ next to the icon in the system font, the same size as the battery
15
+ percentage
16
+ - **Floating widget** — a large, draggable, always-on-top desktop display
17
+ for when the tray slot is too small; resizable, position remembered
18
+ - **Adjustable tray text** — two-line (square) or side-by-side (wide)
19
+ layout, 0.6x–2x text size
20
+ - **Per-interface control** — physical interfaces by default; virtual
21
+ interfaces (docker, bridges, loopback) filtered out; VPN tunnels opt-in
22
+ - **Bits or bytes** — Mbps or MB/s, decimal or 1024-based units
23
+ - **Dark & light panels** — outlined tray text that stays legible anywhere
24
+ - **Launch at startup** — app-managed autostart, no installer tricks
25
+ - **Single instance** — starting it twice just focuses the running app
26
+ - **Settings that persist** — plain TOML in your config directory
27
+
28
+ ## Roadmap
29
+
30
+ | Release | Scope |
31
+ |---|---|
32
+ | v0.1 (in progress) | Live throughput tray app |
33
+ | v0.2 | Speed tests: built-in HTTP backend, optional Ookla CLI integration (never bundled), LibreSpeed for self-hosters; scheduled + on-demand |
34
+ | v0.3 | History with graphs, data-usage totals, data-cap alerts, CSV/JSON export |
35
+ | v1.0 | Polished installers: `.deb`, Windows installer + portable, macOS dmg — all built by CI from a git tag |
36
+
37
+ ## Install
38
+
39
+ **PyPI** (once a version has been published — check the
40
+ [project page](https://pypi.org/project/speedpulse/)):
41
+
42
+ ```bash
43
+ pip install speedpulse # or: pipx install speedpulse
44
+ ```
45
+
46
+ **From the GitHub releases** (preferred for end users): grab the `.deb`,
47
+ Windows installer/portable, or macOS dmg from the
48
+ [releases page](https://github.com/rafi138/speedpulse/releases).
49
+
50
+ **From source:**
51
+
52
+ ```bash
53
+ git clone https://github.com/rafi138/speedpulse
54
+ cd speedpulse
55
+ python -m venv .venv && source .venv/bin/activate
56
+ pip install -e .
57
+ speedpulse
58
+ ```
59
+
60
+ - **GNOME/Ubuntu**: needs the *AppIndicator and KStatusNotifierItem Support*
61
+ extension (pre-installed on Ubuntu). GNOME gives every tray icon a fixed
62
+ 16×16 px square — too small for legible text — so there SpeedPulse shows
63
+ the rates as **panel text** next to its icon instead: drawn by GNOME in
64
+ the system font, the same size as the battery percentage.
65
+ - **KDE, Xfce, Cinnamon, MATE** and most other Linux desktops show tray
66
+ icons natively.
67
+ - Windows/macOS: no extra requirements.
68
+
69
+ ## Platform notes
70
+
71
+ - **GNOME without the AppIndicator extension**: GNOME Shell has no tray of
72
+ its own, so nothing can show a tray icon. SpeedPulse detects this and logs
73
+ a hint (`speedpulse -v`).
74
+ - **Icon-only on GNOME**: Settings → *Show rates as panel text* switches the
75
+ indicator back to an icon without text, like on other desktops.
76
+ - **Classic tray icon on GNOME**: `SPEEDPULSE_TRAY=qt speedpulse` bypasses
77
+ the panel-text indicator and uses Qt's generic tray icon — the escape
78
+ hatch should the indicator ever misbehave.
79
+ - **Tray text too small elsewhere**: try Settings → *Tray layout* and *Tray
80
+ text size*, or enable the *floating widget*.
81
+ - **Unsigned builds**: until code signing is set up, Windows may show a
82
+ SmartScreen prompt and macOS Gatekeeper requires *System Settings →
83
+ Privacy & Security → Open Anyway* on first launch.
84
+
85
+ ## Development
86
+
87
+ ```bash
88
+ pip install -e ".[dev]"
89
+ pre-commit install
90
+ pytest # pure-core tests + offscreen GUI smoke tests
91
+ ruff check . && ruff format --check .
92
+ pyright src tests
93
+ ```
94
+
95
+ On Linux the tests also need `dbus-daemon`: the GNOME panel-text indicator
96
+ is exercised against a private session bus.
97
+
98
+ The codebase is strictly split: `src/speedpulse/core/` is pure Python
99
+ (headless-testable, no GUI imports); `src/speedpulse/ui/` is a thin Qt
100
+ adapter layer. See [PLAN.md](PLAN.md) for the full architecture and roadmap.
101
+
102
+ ## Contributing
103
+
104
+ Contributions are welcome — please open an issue first for anything beyond
105
+ small fixes. PRs are reviewed by the maintainer before merging; see
106
+ [CONTRIBUTING.md](CONTRIBUTING.md).
107
+
108
+ ## License
109
+
110
+ [MIT](LICENSE)
@@ -0,0 +1,112 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.21"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "speedpulse"
7
+ version = "0.1.3"
8
+ description = "Cross-platform internet speed monitor for your system tray: live throughput plus on-demand speed tests."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [{ name = "SpeedPulse contributors" }]
12
+ requires-python = ">=3.11"
13
+ keywords = ["network", "speed", "monitor", "tray", "bandwidth", "speedtest"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Environment :: X11 Applications",
17
+ "Environment :: Win32 (MS Windows)",
18
+ "Environment :: MacOS X",
19
+ "Intended Audience :: End Users/Desktop",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: Microsoft :: Windows",
22
+ "Operating System :: MacOS",
23
+ "Operating System :: POSIX :: Linux",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: System :: Monitoring",
30
+ "Topic :: System :: Networking :: Monitoring",
31
+ ]
32
+ dependencies = [
33
+ "psutil>=5.9.0",
34
+ "PySide6>=6.8.0,<7.0",
35
+ # Linux only: speaks StatusNotifierItem/dbusmenu so GNOME's panel can draw
36
+ # the rates as text. Pure Python; nothing to install elsewhere.
37
+ "jeepney>=0.8; sys_platform == 'linux'",
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ # ruff and pyright are pinned EXACTLY and must stay in lockstep with
42
+ # .pre-commit-config.yaml — CI, pre-commit and contributors all enforce
43
+ # the same versions. Bump all three together.
44
+ dev = [
45
+ "pytest>=8.0",
46
+ "pytest-qt>=4.4",
47
+ "pytest-cov>=5.0",
48
+ "ruff==0.17.5",
49
+ "pyright==1.1.414",
50
+ "pre-commit>=3.7",
51
+ ]
52
+ # release packaging: PyInstaller onedir payload + icon generation (ICO via Pillow)
53
+ build = [
54
+ "pyinstaller>=6.10",
55
+ "pillow>=10.0",
56
+ ]
57
+
58
+ [project.urls]
59
+ Homepage = "https://github.com/rafi138/speedpulse"
60
+ Issues = "https://github.com/rafi138/speedpulse/issues"
61
+ Changelog = "https://github.com/rafi138/speedpulse/blob/main/CHANGELOG.md"
62
+
63
+ [project.gui-scripts]
64
+ speedpulse = "speedpulse.app:main"
65
+
66
+ [tool.hatch.build.targets.wheel]
67
+ packages = ["src/speedpulse"]
68
+
69
+ [tool.hatch.build.targets.sdist]
70
+ include = ["src", "tests", "README.md", "CHANGELOG.md", "LICENSE"]
71
+
72
+ # ---------------------------------------------------------------- ruff
73
+ [tool.ruff]
74
+ line-length = 100
75
+ target-version = "py311"
76
+ src = ["src", "tests"]
77
+ extend-exclude = ["dist", "build"]
78
+
79
+ [tool.ruff.lint]
80
+ select = [
81
+ "E", # pycodestyle errors
82
+ "W", # pycodestyle warnings
83
+ "F", # pyflakes
84
+ "I", # isort
85
+ "UP", # pyupgrade
86
+ "B", # bugbear
87
+ "SIM", # simplify
88
+ "C4", # comprehensions
89
+ "RET", # return
90
+ "RUF", # ruff-specific
91
+ ]
92
+
93
+ [tool.ruff.lint.per-file-ignores]
94
+ # GUI smoke tests legitimately skip when Qt can't initialise.
95
+ "tests/gui/*" = ["B011"]
96
+
97
+ # ---------------------------------------------------------------- pytest
98
+ [tool.pytest.ini_options]
99
+ testpaths = ["tests"]
100
+ addopts = "-q --strict-markers"
101
+ markers = [
102
+ "gui: tests that construct Qt widgets (offscreen in CI)",
103
+ ]
104
+
105
+ # ---------------------------------------------------------------- pyright
106
+ [tool.pyright]
107
+ include = ["src", "tests"]
108
+ typeCheckingMode = "basic"
109
+ pythonVersion = "3.11"
110
+ venvPath = "."
111
+ venv = ".venv"
112
+ reportMissingImports = "warning"
@@ -0,0 +1,4 @@
1
+ """SpeedPulse: cross-platform internet speed monitor for the system tray."""
2
+
3
+ __version__ = "0.1.3"
4
+ APP_NAME = "SpeedPulse"
@@ -0,0 +1,10 @@
1
+ """``python -m speedpulse`` entry point.
2
+
3
+ Must use absolute imports: PyInstaller also executes this file as the
4
+ bundled launcher, where relative imports have no parent package.
5
+ """
6
+
7
+ from speedpulse.app import main
8
+
9
+ if __name__ == "__main__":
10
+ raise SystemExit(main())
@@ -0,0 +1,98 @@
1
+ """Composition root: parse args, wire core + UI, run the Qt event loop."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import logging
7
+ import signal
8
+ import sys
9
+ from pathlib import Path
10
+
11
+ from PySide6 import QtCore, QtWidgets
12
+
13
+ from . import APP_NAME, __version__
14
+ from .core.autostart import get_autostart
15
+ from .core.config import config_path, load
16
+ from .core.sampler import Sampler
17
+ from .core.singleinstance import SingleInstanceLock
18
+ from .ui.tray import SpeedPulseTray
19
+
20
+ log = logging.getLogger(APP_NAME.lower())
21
+
22
+
23
+ def main(argv: list[str] | None = None) -> int:
24
+ parser = argparse.ArgumentParser(
25
+ prog="speedpulse",
26
+ description="Internet speed monitor for your system tray.",
27
+ )
28
+ parser.add_argument("--config", type=Path, default=None, help="path to config.toml")
29
+ parser.add_argument("-v", "--verbose", action="store_true", help="debug logging")
30
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
31
+ args = parser.parse_args(argv)
32
+
33
+ logging.basicConfig(
34
+ level=logging.DEBUG if args.verbose else logging.INFO,
35
+ format="%(asctime)s %(levelname)s %(name)s: %(message)s",
36
+ )
37
+
38
+ lock = SingleInstanceLock()
39
+ if not lock.acquire():
40
+ log.info("%s is already running; exiting.", APP_NAME)
41
+ return 0
42
+
43
+ settings_path = args.config or config_path()
44
+ settings = load(settings_path)
45
+ log.info("Starting %s %s (config: %s)", APP_NAME, __version__, settings_path)
46
+
47
+ app = QtWidgets.QApplication(sys.argv)
48
+ app.setApplicationName(APP_NAME)
49
+ app.setApplicationVersion(__version__)
50
+ app.setApplicationDisplayName(APP_NAME)
51
+ # The tray icon *is* the app; closing the settings window must not quit.
52
+ app.setQuitOnLastWindowClosed(False)
53
+
54
+ sampler = Sampler(settings.sampler)
55
+ tray = SpeedPulseTray(
56
+ settings=settings,
57
+ settings_path=settings_path,
58
+ sampler=sampler,
59
+ autostart=get_autostart(),
60
+ )
61
+ tray.welcome()
62
+
63
+ _install_signal_handlers(app)
64
+
65
+ try:
66
+ code = app.exec()
67
+ finally:
68
+ tray.shutdown()
69
+ lock.release()
70
+ return code
71
+
72
+
73
+ def _install_signal_handlers(app: QtWidgets.QApplication) -> None:
74
+ """Route SIGINT/SIGTERM into Qt's quit path.
75
+
76
+ During ``app.exec()`` the interpreter only gets control back when a
77
+ Python callback runs, so a short no-op timer keeps signal handlers
78
+ alive; otherwise Ctrl+C would appear dead until the next event.
79
+ """
80
+
81
+ def _quit(*_args: object) -> None:
82
+ app.quit()
83
+
84
+ for sig in (signal.SIGINT, signal.SIGTERM):
85
+ try:
86
+ signal.signal(sig, _quit)
87
+ except (OSError, ValueError): # pragma: no cover - platform-dependent
88
+ log.debug("Could not install handler for %s", sig)
89
+ keepalive = QtCore.QTimer()
90
+ keepalive.timeout.connect(lambda: None)
91
+ keepalive.start(250)
92
+ # Keep a reference for the app's lifetime (QTimer with no parent would
93
+ # otherwise be garbage-collected, silently breaking Ctrl+C).
94
+ app._speedpulse_keepalive = keepalive # type: ignore[attr-defined]
95
+
96
+
97
+ if __name__ == "__main__":
98
+ sys.exit(main())
@@ -0,0 +1,5 @@
1
+ """Pure, headless-testable core: measurement, units, config, autostart.
2
+
3
+ Nothing in this package may import a GUI toolkit. The UI layer
4
+ (:mod:`speedpulse.ui`) adapts these primitives to the system tray.
5
+ """