feat(tray): opt-in system tray icon with savings counter, dashboard and update alert (#4726)

## Description

Adds an **opt-in system tray icon** for Headroom while it runs (Windows
first; macOS/Linux planned). The icon is the Headroom logomark and its
right-click menu shows a compact savings counter (tokens and estimated $
saved), opens the dashboard, alerts when an update is available, and
lets you quit.

Closes #

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- New `headroom/tray/` package: `core.py` (GUI-free stats
polling/formatting), `icon.py` (logomark drawn with Pillow, no binary
assets in the wheel), `app.py` (pystray app), `launcher.py` (spawns the
tray as a child of the proxy).
- `headroom proxy --tray` starts the tray with the proxy; `headroom tray
--port N` attaches to a running proxy.
- Menu: live `▼ tokens · ~$ saved` counter (from `/stats` →
`persistent_savings.lifetime`, polled every 5s), Open Dashboard, "Update
available" (only when newer; reuses `headroom.update_check`, honours
`HEADROOM_UPDATE_CHECK=off`; one-time notification), Quit.
- Icon states: normal, orange dot when an update exists, grey when the
proxy is offline.
- New optional extra `headroom-ai[tray]` (`pystray`, `pillow`).
Unsupported platform / missing extra: `--tray` prints why and the proxy
starts normally.
- Docs: `docs/content/docs/system-tray.mdx` + nav entry; screenshots in
`docs/public/assets/tray/`.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [x] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
> python -m ruff check headroom\tray headroom\cli tests\test_tray_core.py
All checks passed!
> python -m mypy headroom\tray headroom\cli\tray.py
Success: no issues found in 7 source files
> python -m pytest tests\test_tray_core.py tests\cli tests\test_offline_egress_chokepoint.py tests\test_proxy\test_settings_store.py -q
293 passed, 2 skipped
```

(Scoped runs; I did not run the full suite or `mypy headroom` over the
whole package.)

## Real Behavior Proof

- Environment: Windows 11, Python 3.13.13, 3840x2160 display, `pystray`
+ `pillow` 12.3.0, branch based on `upstream/main` @ 1da8930ab.
- Exact command / steps: run the 4 steps below.
1. `HEADROOM_UPDATE_CHECK=off`, then `python -m headroom.cli proxy
--tray --port 8799`
2. Confirmed `GET /health` → 200 and a `python -m headroom.tray --host
127.0.0.1 --port 8799 --owns-proxy` child process.
3. Opened the taskbar overflow, right-clicked the Headroom icon,
captured the menu (below).
  4. Clicked **Quit Headroom**.
- Observed result: icon appeared with the logomark; menu showed `▼ 256M
tokens · ~$765.96 saved` (my real lifetime savings store), **Open
Dashboard**, **Quit Headroom**. After Quit, `/health` no longer
responded (proxy shut down gracefully).
- Not tested: the real update toast and "Update available" menu item
(covered only by a unit test of `available_update()` and a rendered
icon); clicking Open Dashboard / double-click default action; macOS and
Linux (intentionally unsupported for now); HiDPI/light-theme variations;
`headroom tray` standalone Exit in the UI.

## Runtime Rollout Safety

- Rollout-managed feature(s): None (not rollout-channel gated).
- Minimum rollout channel: N/A
- Stable/default behavior changed: No. Off by default; only active with
`--tray`.
- Kill switch / disable path: omit `--tray` (or pass `--no-tray`).
- Unsafe override required: No.
- Qualification impact: None.
- Rollback path: revert this PR; the new extra and command are additive.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes (only
`tests/test_tray_core.py` and `tests/cli` were run)
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Screenshots (if applicable)

**Tray icon** (left: real icon in the Windows taskbar overflow, zoomed;
then rendered states: live, update available, proxy offline)

![Tray icon
states](https://raw.githubusercontent.com/JerrettDavis/headroom/3e824653772642c95fded190b454fff82f2ce86a/docs/public/assets/tray/tray-icon.png)

**Right-click menu** (real capture)

![Tray right-click
menu](https://raw.githubusercontent.com/JerrettDavis/headroom/3e824653772642c95fded190b454fff82f2ce86a/docs/public/assets/tray/tray-menu.png)

**How to use**

```bash
pip install "headroom-ai[tray]"
headroom proxy --tray        
headroom tray --port 8787    # attach to an already-running proxy
```

Windows hides new tray icons in the `^` overflow next to the clock; drag
the icon onto the taskbar to pin it, then right-click. Full guide:
`docs/content/docs/system-tray.mdx`.

## Feature spec

- **API surface**: `headroom proxy --tray/--no-tray`, `headroom tray
--port N`, extra `headroom-ai[tray]`. No change to existing behavior
when the flag is absent.
- **User stories**: Given the proxy runs with `--tray`, when I
right-click the icon, then I see tokens/$ saved, Open Dashboard and
Quit. Edge: given the proxy is down, the icon turns grey and the tooltip
says offline.
- **Failure modes / recovery**: unsupported platform or missing extra
prints a reason and the proxy starts normally; the tray child exits when
the proxy dies (stdin EOF); a stats fetch failure shows the offline
state and retries every 5s. Quit sends SIGINT for graceful shutdown
without a force-exit deadline.
- **Security**: tray only polls the local proxy `/stats`; no network
calls of its own (update info read from the existing cache; honours
`HEADROOM_UPDATE_CHECK=off`); child is spawned with a fixed argv.

## Dependency justification

- **Why**: `pystray` is the standard cross-platform tray library
(Win/macOS/Linux); `pillow` is required by it for icons and lets us draw
the logomark with no binary assets. No existing dep provides a tray.
- **Maintainers**: pystray (moses-palmer), BSD/LGPL, stable ~0.19.5
releases; Pillow (python-pillow org), very active, frequent security
releases.
- **Install surface**: optional extra only (not default). pystray pulls
`six`, plus pywin32-free ctypes on Windows; Pillow ships prebuilt
wheels. No install-time network access.
- **Why these versions**: `pystray>=0.19.5` is the current release
(required new functionality); `pillow>=12.3.0` matches the repo pin
level already used elsewhere to avoid known CVEs.

## Additional Notes

- The menu screenshot shows my real local savings numbers.
- The Quit item stops the proxy only when the tray was started via
`headroom proxy --tray`; the standalone `headroom tray` shows "Exit" and
only closes the tray.
- Follow-ups: macOS/Linux backends (pystray needs the main thread on
macOS, hence the child-process design).

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
JD Davis
2026-11-16 19:40:55 -06:00
committed by GitHub
co-authored by Copilot
parent ba26fd7d92
commit e9301f34c1
17 changed files with 797 additions and 1 deletions
+1
View File
@@ -25,6 +25,7 @@
"failure-learning",
"---Proxy Server---",
"proxy",
"system-tray",
"corporate-networks",
"local-llm-prefill",
"---Integrations---",
+47
View File
@@ -0,0 +1,47 @@
---
title: System Tray
description: Opt-in tray icon that shows tokens and dollars saved, opens the dashboard, and alerts you when a new Headroom release is out.
---
Headroom can show a small icon in your system tray while it runs. It is **opt-in** and **Windows only for now** (macOS and Linux are planned).
![Headroom tray icon states: live, update available, proxy offline](/assets/tray/tray-icon.png)
## Install
```bash
pip install "headroom-ai[tray]"
```
## Use it
Start the proxy with the tray:
```bash
headroom proxy --tray
```
Or attach a tray to a proxy that is already running:
```bash
headroom tray --port 8787
```
The icon is the Headroom logomark. Windows hides new icons in the overflow flyout (the `^` arrow by the clock); drag it onto the taskbar to pin it. Right-click it:
![Headroom tray right-click menu](/assets/tray/tray-menu.png)
| Item | What it does |
| --- | --- |
| `▼ 256M tokens · ~$765.96 saved` | Lifetime tokens and estimated dollars saved (input compression plus output reduction). Click to open the dashboard. |
| **Open Dashboard** | Opens `/dashboard` of the proxy. Also the double-click action. |
| **Update available: x.y.z** | Appears only when a newer release exists; opens the release page. A one-time notification is also shown. |
| **Quit Headroom** | With `headroom proxy --tray`, shuts the proxy down gracefully. With `headroom tray`, only closes the tray (`Exit`). |
The icon turns grey while the proxy is unreachable and gets an orange dot when an update is available. Hovering shows the same totals.
## Notes
- Stats are polled from the proxy's `/stats` endpoint every 5 seconds; nothing leaves your machine.
- Update alerts reuse Headroom's existing update check and honour `HEADROOM_UPDATE_CHECK=off`.
- On unsupported platforms or without the extra, `--tray` prints why and the proxy starts normally.
+9
View File
@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="256" height="256" role="img" aria-label="Headroom logomark">
<rect width="32" height="32" rx="6" fill="#070A0F"/>
<g stroke-linecap="square">
<path d="M 11 8 L 7 8 L 7 24 L 11 24" fill="none" stroke="#00F0B5" stroke-width="2"/>
<path d="M 21 8 L 25 8 L 25 24 L 21 24" fill="none" stroke="#00F0B5" stroke-width="2"/>
<rect x="11" y="14" width="10" height="2" fill="#00F0B5"/>
<rect x="13" y="18" width="6" height="2" fill="#00F0B5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

+1
View File
@@ -120,6 +120,7 @@ def _register_commands() -> None:
savings, # noqa: F401
telemetry, # noqa: F401
tools, # noqa: F401
tray, # noqa: F401
update, # noqa: F401
wrap, # noqa: F401
)
+14
View File
@@ -484,6 +484,15 @@ def dashboard(port: int | None, no_open: bool) -> None:
"Requires HEADROOM_ROLLOUT_CHANNEL=canary (or dev)."
),
)
@click.option(
"--tray/--no-tray",
"tray",
default=False,
help=(
"Show a system tray icon with savings, dashboard link and update alerts "
"(opt-in, Windows; needs headroom-ai[tray])"
),
)
@click.option("--no-optimize", is_flag=True, help="Disable optimization (passthrough mode)")
@click.option("--no-cache", is_flag=True, help="Disable semantic caching")
@click.option("--no-rate-limit", is_flag=True, help="Disable rate limiting")
@@ -1230,6 +1239,7 @@ def proxy(
http2: bool,
http_proxy: str | None,
intercept_tool_results: bool,
tray: bool,
no_optimize: bool,
no_cache: bool,
no_rate_limit: bool,
@@ -2030,6 +2040,10 @@ Press Ctrl+C to stop.
# a richer one above. Direct `python -m headroom.proxy.server` keeps
# the legacy banner via run_server's default.
run_kwargs["print_banner"] = False
if tray:
from headroom.tray.launcher import start_tray_for_proxy
start_tray_for_proxy(host, port)
run_server(config, **run_kwargs)
except KeyboardInterrupt:
click.echo("\nShutting down...")
+25
View File
@@ -0,0 +1,25 @@
"""`headroom tray` — standalone system tray for an already-running proxy."""
from __future__ import annotations
import click
from .main import main
@main.command("tray")
@click.option("--host", default="127.0.0.1", envvar="HEADROOM_HOST", show_default=True)
@click.option("--port", "-p", default=8787, envvar="HEADROOM_PORT", show_default=True)
def tray(host: str, port: int) -> None:
"""Show a system tray icon with savings, dashboard link and update alerts.
Attach it to a proxy that is already running, or start both at once with
`headroom proxy --tray`. Requires: pip install 'headroom-ai[tray]'
"""
from headroom.tray.app import run_tray, tray_available
from headroom.tray.core import base_url
ok, reason = tray_available()
if not ok:
raise click.ClickException(f"Tray unavailable: {reason}")
raise SystemExit(run_tray(base_url(host, port)))
+1
View File
@@ -0,0 +1 @@
"""Opt-in system tray icon for Headroom (Windows first)."""
+45
View File
@@ -0,0 +1,45 @@
"""Entry point used when the tray is spawned as a child of ``headroom proxy --tray``."""
from __future__ import annotations
import argparse
import os
import sys
import threading
def _exit_when_stdin_closes() -> None:
# The proxy owns our stdin pipe; EOF means it died, so don't linger as an orphan.
try:
while sys.stdin.buffer.read(1024):
pass
except Exception:
pass
os._exit(0)
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(prog="python -m headroom.tray")
parser.add_argument("--host", default="127.0.0.1")
parser.add_argument("--port", type=int, default=8787)
parser.add_argument("--owns-proxy", action="store_true")
args = parser.parse_args(argv)
from .app import run_tray, tray_available
from .core import base_url
ok, reason = tray_available()
if not ok:
print(f"headroom tray unavailable: {reason}", file=sys.stderr)
return 2
if args.owns_proxy:
threading.Thread(target=_exit_when_stdin_closes, daemon=True).start()
code = run_tray(base_url(args.host, args.port), owns_proxy=args.owns_proxy)
# Skip interpreter finalization: the stdin reader thread is blocked in a read.
sys.stdout.flush()
sys.stderr.flush()
os._exit(code)
if __name__ == "__main__":
raise SystemExit(main())
+110
View File
@@ -0,0 +1,110 @@
"""System tray app (pystray). Needs the optional ``headroom-ai[tray]`` extra."""
from __future__ import annotations
import sys
import threading
import webbrowser
from collections.abc import Callable
from typing import Any
from . import core
from .icon import render_icon
# Exit code the tray uses to ask its owning ``headroom proxy`` to shut down.
QUIT_EXIT_CODE = 64
RELEASES_URL = "https://github.com/headroomlabs-ai/headroom/releases/latest"
POLL_SECONDS = 5.0
def tray_available() -> tuple[bool, str]:
"""Whether the tray can run here, and why not when it can't."""
if sys.platform != "win32":
return False, "the system tray is currently supported on Windows only"
try:
import PIL # noqa: F401
import pystray # noqa: F401
except ImportError:
return False, "missing dependency; install with: pip install 'headroom-ai[tray]'"
return True, ""
class _State:
def __init__(self) -> None:
self.snap = core.Snapshot()
self.update: str | None = None
self.notified: str | None = None
self.exit_code = 0
def run_tray(
url: str,
*,
owns_proxy: bool = False,
poll_seconds: float = POLL_SECONDS,
on_ready: Callable[[], None] | None = None,
) -> int:
"""Run the tray until the user exits. Returns the process exit code."""
import pystray
state = _State()
stop = threading.Event()
def open_dashboard(icon: Any = None, item: Any = None) -> None:
webbrowser.open(core.dashboard_url(url))
def open_release(icon: Any = None, item: Any = None) -> None:
webbrowser.open(RELEASES_URL)
def quit_app(icon: Any, item: Any = None) -> None:
state.exit_code = QUIT_EXIT_CODE if owns_proxy else 0
stop.set()
icon.stop()
menu = pystray.Menu(
pystray.MenuItem("Headroom", None, enabled=False),
pystray.MenuItem(lambda _i: core.stats_label(state.snap), open_dashboard),
pystray.Menu.SEPARATOR,
pystray.MenuItem("Open Dashboard", open_dashboard, default=True),
pystray.MenuItem(
lambda _i: f"Update available: {state.update}",
open_release,
visible=lambda _i: bool(state.update),
),
pystray.Menu.SEPARATOR,
pystray.MenuItem("Quit Headroom" if owns_proxy else "Exit", quit_app),
)
icon = pystray.Icon("headroom", render_icon(online=False), "Headroom", menu)
def refresh() -> None:
snap, update = core.fetch_snapshot(url), core.available_update()
state.snap, state.update = snap, update
icon.icon = render_icon(online=snap.online, update=bool(update))
icon.title = core.tooltip(snap, update)
icon.update_menu()
if update and state.notified != update:
state.notified = update
try:
icon.notify(
f"Headroom {update} is available. Run: headroom update", "Headroom update"
)
except Exception:
pass
def poll_loop() -> None:
while not stop.is_set():
try:
refresh()
except Exception:
pass
stop.wait(poll_seconds)
def setup(icon: Any) -> None:
icon.visible = True
threading.Thread(target=poll_loop, name="headroom-tray-poll", daemon=True).start()
if on_ready:
on_ready()
icon.run(setup)
stop.set()
return state.exit_code
+164
View File
@@ -0,0 +1,164 @@
"""Pure (GUI-free) logic for the Headroom system tray: stats polling and formatting."""
from __future__ import annotations
import ipaddress
import json
import urllib.request
from dataclasses import dataclass
from typing import Any
from urllib.parse import urlparse
DEFAULT_PORT = 8787
@dataclass(frozen=True)
class Snapshot:
"""What the tray shows: lifetime tokens and estimated dollars saved."""
online: bool = False
tokens_saved: int = 0
usd_saved: float = 0.0
requests: int = 0
def base_url(host: str, port: int) -> str:
# A wildcard bind address is not connectable; talk to loopback instead.
if host in ("", "0.0.0.0", "::", "[::]"): # noqa: S104 — comparison, not a bind
host = "127.0.0.1"
if ":" in host and not host.startswith("["):
host = f"[{host}]"
return f"http://{host}:{port}"
def dashboard_url(url: str) -> str:
return f"{url}/dashboard"
def parse_stats(payload: dict[str, Any]) -> Snapshot:
"""Extract the tray figures from a ``/stats`` payload (missing keys -> 0)."""
persistent = payload.get("persistent_savings")
lifetime = persistent.get("lifetime") if isinstance(persistent, dict) else None
if not isinstance(lifetime, dict):
lifetime = {}
def _num(key: str) -> float:
value = lifetime.get(key)
return float(value) if isinstance(value, (int, float)) else 0.0
tokens = _num("tokens_saved") + _num("output_tokens_saved")
usd = _num("compression_savings_usd") + _num("output_savings_usd")
return Snapshot(
online=True,
tokens_saved=int(tokens),
usd_saved=usd,
requests=int(_num("requests")),
)
def is_loopback_url(url: str) -> bool:
"""True only for http URLs whose host is localhost or a loopback IP literal."""
try:
parsed = urlparse(url)
host = (parsed.hostname or "").lower()
if parsed.scheme != "http" or not host:
return False
return host == "localhost" or ipaddress.ip_address(host).is_loopback
except ValueError:
return False
class _NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, *args: Any, **kwargs: Any) -> None:
return None
# No environment proxies and no redirects: the poll can never leave loopback.
_OPENER = urllib.request.build_opener(urllib.request.ProxyHandler({}), _NoRedirect())
def fetch_snapshot(url: str, *, timeout: float = 3.0) -> Snapshot:
"""Poll the local proxy. Never raises; an unreachable proxy yields ``online=False``.
Only loopback URLs are polled, regardless of ``HEADROOM_OFFLINE``; any other
host is refused without making a request.
"""
if not is_loopback_url(url):
return Snapshot()
try:
req = urllib.request.Request( # noqa: S310 — loopback-only, validated above
f"{url}/stats?cached=1", headers={"Accept": "application/json"}
)
with _OPENER.open(req, timeout=timeout) as resp:
data = json.loads(resp.read().decode("utf-8"))
return parse_stats(data) if isinstance(data, dict) else Snapshot()
except Exception:
return Snapshot()
def format_tokens(count: int) -> str:
"""Compact token count: 950, 12.3K, 4.56M, 1.20B."""
n = max(int(count), 0)
if n < 1_000:
return str(n)
for divisor, suffix in ((1_000, "K"), (1_000_000, "M"), (1_000_000_000, "B")):
value = n / divisor
digits = 2 if value < 10 else 1 if value < 100 else 0
if round(value, digits) < 1000 or suffix == "B":
return f"{value:.{digits}f}{suffix}"
return str(n)
def format_usd(amount: float) -> str:
amount = max(float(amount), 0.0)
if amount >= 1_000_000:
return f"${amount / 1_000_000:.2f}M"
if amount >= 10_000:
return f"${amount / 1_000:.1f}K"
return f"${amount:,.2f}"
def stats_label(snap: Snapshot) -> str:
if not snap.online:
return "Proxy offline"
return (
f"\u25bc {format_tokens(snap.tokens_saved)} tokens \u00b7 "
f"~{format_usd(snap.usd_saved)} saved"
)
def tooltip(snap: Snapshot, update: str | None = None) -> str:
if not snap.online:
text = "Headroom - proxy offline"
else:
text = (
f"Headroom - {format_tokens(snap.tokens_saved)} tokens, "
f"~{format_usd(snap.usd_saved)} saved"
)
if update:
text += f" - update {update} available"
return text[:127] # Windows tray tooltips are capped at 127 chars
def available_update() -> str | None:
"""Latest version when newer than the installed one (cache only, no network)."""
try:
from packaging.version import Version
from headroom.update_check import (
_in_docker,
_is_source_checkout,
installed_version,
is_update_check_enabled,
read_cache,
)
if not is_update_check_enabled() or _is_source_checkout() or _in_docker():
return None
cache = read_cache() or {}
latest, current = cache.get("latest_version"), installed_version()
if isinstance(latest, str) and current and Version(latest) > Version(current):
return latest
except Exception:
pass
return None
+52
View File
@@ -0,0 +1,52 @@
"""Tray icon: the Headroom logomark, drawn with Pillow so no binary assets ship in the wheel.
Geometry and colours are the published brand logomark (see ``docs/public/assets/headroom-logomark.svg``):
two square brackets around a compressing pair of bars, in Headroom Mint on Obsidian Space.
"""
from __future__ import annotations
from typing import Any
MINT = (0, 240, 181, 255) # #00F0B5
OBSIDIAN = (7, 10, 15, 255) # #070A0F
OFFLINE = (113, 113, 122, 255)
BADGE = (255, 140, 40, 255)
WHITE = (255, 255, 255, 255)
# Logomark rectangles on its native 32x32 grid: (x0, y0, x1, y1).
_MARK_RECTS = (
(6, 7, 12, 9), # left bracket, top arm
(6, 7, 8, 25), # left bracket, spine
(6, 23, 12, 25), # left bracket, bottom arm
(20, 7, 26, 9), # right bracket, top arm
(24, 7, 26, 25), # right bracket, spine
(20, 23, 26, 25), # right bracket, bottom arm
(11, 14, 21, 16), # upper bar
(13, 18, 19, 20), # lower bar
)
def render_icon(*, online: bool = True, update: bool = False, size: int = 64) -> Any:
"""Logomark on a dark rounded tile; grey when offline, orange dot when an update exists."""
from PIL import Image, ImageDraw
ss = 4 # supersample for smooth edges
s = size * ss
img = Image.new("RGBA", (s, s), (0, 0, 0, 0))
d = ImageDraw.Draw(img)
d.rounded_rectangle((0, 0, s - 1, s - 1), radius=s // 5, fill=OBSIDIAN)
# Crop the 32-unit grid to 4..28 so the mark fills the tile at 16px.
lo, span = 4.0, 24.0
k = s / span
color = MINT if online else OFFLINE
for x0, y0, x1, y1 in _MARK_RECTS:
d.rectangle(
((x0 - lo) * k, (y0 - lo) * k, (x1 - lo) * k - 1, (y1 - lo) * k - 1), fill=color
)
if update:
r, pad = s * 0.19, s * 0.01
d.ellipse((s - 2 * r - pad, pad, s - pad, 2 * r + pad), fill=BADGE, outline=WHITE, width=ss)
return img.resize((size, size), Image.Resampling.LANCZOS)
+59
View File
@@ -0,0 +1,59 @@
"""Spawn the tray as a child of ``headroom proxy --tray``."""
from __future__ import annotations
import logging
import signal
import subprocess
import sys
import threading
from .app import QUIT_EXIT_CODE, tray_available
logger = logging.getLogger(__name__)
def request_graceful_shutdown() -> None:
"""Signal the proxy to shut down via its normal SIGINT path.
No hard-exit deadline is scheduled: uvicorn's request drain, the sequential
cleanup steps and the savings flush have no single bounded total, so a fixed
timer could kill the process before persistence completes. A second SIGINT
(or the OS) remains the operator's escape hatch for a hung shutdown.
"""
signal.raise_signal(signal.SIGINT)
def start_tray_for_proxy(host: str, port: int) -> subprocess.Popen[bytes] | None:
"""Start the tray; returns None (after logging why) when it can't run. Never raises."""
ok, reason = tray_available()
if not ok:
logger.warning("Tray not started: %s", reason)
print(f" Tray not started: {reason}", file=sys.stderr)
return None
try:
flags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
child = subprocess.Popen( # noqa: S603 — fixed argv, our own interpreter
[
sys.executable,
"-m",
"headroom.tray",
"--host",
host,
"--port",
str(port),
"--owns-proxy",
],
stdin=subprocess.PIPE,
creationflags=flags,
)
except Exception as exc:
logger.warning("Tray not started: %s", exc)
return None
def _watch() -> None:
if child.wait() == QUIT_EXIT_CODE:
request_graceful_shutdown()
threading.Thread(target=_watch, name="headroom-tray-watch", daemon=True).start()
return child
+5
View File
@@ -330,6 +330,11 @@ bedrock = [
redis = [
"redis>=5.0.0",
]
# System tray icon (opt-in: `headroom proxy --tray` / `headroom tray`; Windows first)
tray = [
"pystray>=0.19.5",
"pillow>=12.3.0",
]
# HTML content extraction
html = [
"trafilatura>=1.6.0",
+176
View File
@@ -0,0 +1,176 @@
from __future__ import annotations
import pytest
from headroom.tray import core
from headroom.tray.core import Snapshot
@pytest.mark.parametrize(
("n", "expected"),
[
(0, "0"),
(950, "950"),
(1_000, "1.00K"),
(12_345, "12.3K"),
(999_999, "1.00M"),
(4_560_000, "4.56M"),
(1_200_000_000, "1.20B"),
],
)
def test_format_tokens(n: int, expected: str) -> None:
assert core.format_tokens(n) == expected
def test_format_usd() -> None:
assert core.format_usd(0) == "$0.00"
assert core.format_usd(1234.5) == "$1,234.50"
assert core.format_usd(25_000) == "$25.0K"
def test_parse_stats_sums_input_and_output_savings() -> None:
snap = core.parse_stats(
{
"persistent_savings": {
"lifetime": {
"tokens_saved": 1000,
"output_tokens_saved": 500,
"compression_savings_usd": 1.5,
"output_savings_usd": 0.25,
"requests": 7,
}
}
}
)
assert snap == Snapshot(online=True, tokens_saved=1500, usd_saved=1.75, requests=7)
def test_parse_stats_tolerates_missing_keys() -> None:
assert core.parse_stats({}) == Snapshot(online=True)
def test_fetch_snapshot_offline_never_raises() -> None:
assert core.fetch_snapshot("http://127.0.0.1:1", timeout=0.2).online is False
def test_base_url_maps_wildcard_and_ipv6() -> None:
assert core.base_url("0.0.0.0", 8787) == "http://127.0.0.1:8787"
assert core.base_url("::1", 9) == "http://[::1]:9"
def test_tooltip_capped_and_mentions_update() -> None:
text = core.tooltip(Snapshot(online=True, tokens_saved=2000, usd_saved=3), "9.9.9")
assert "2.00K" in text and "9.9.9" in text and len(text) <= 127
assert "offline" in core.tooltip(Snapshot())
def test_available_update(monkeypatch: pytest.MonkeyPatch) -> None:
import headroom.update_check as uc
monkeypatch.setattr(uc, "is_update_check_enabled", lambda: True)
monkeypatch.setattr(uc, "_is_source_checkout", lambda: False)
monkeypatch.setattr(uc, "_in_docker", lambda: False)
monkeypatch.setattr(uc, "installed_version", lambda: "1.0.0")
monkeypatch.setattr(uc, "read_cache", lambda: {"latest_version": "1.2.0"})
assert core.available_update() == "1.2.0"
monkeypatch.setattr(uc, "read_cache", lambda: {"latest_version": "1.0.0"})
assert core.available_update() is None
monkeypatch.setattr(uc, "_in_docker", lambda: True)
monkeypatch.setattr(uc, "read_cache", lambda: {"latest_version": "1.2.0"})
assert core.available_update() is None
def test_icon_renders_all_states() -> None:
pytest.importorskip("PIL")
from headroom.tray.icon import render_icon
for online in (True, False):
for update in (True, False):
assert render_icon(online=online, update=update, size=32).size == (32, 32)
@pytest.mark.parametrize(
("url", "expected"),
[
("http://127.0.0.1:8787", True),
("http://localhost:8787", True),
("http://[::1]:8787", True),
("http://example.com:8787", False),
("http://10.0.0.5:8787", False),
("https://127.0.0.1:8787", False),
("http://127.0.0.1.evil.com:8787", False),
],
)
def test_is_loopback_url(url: str, expected: bool) -> None:
assert core.is_loopback_url(url) is expected
def test_fetch_snapshot_refuses_remote_host_even_when_offline(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setenv("HEADROOM_OFFLINE", "1")
calls: list[object] = []
monkeypatch.setattr(core._OPENER, "open", lambda *a, **k: calls.append(a))
monkeypatch.setattr("urllib.request.urlopen", lambda *a, **k: calls.append(a))
assert core.fetch_snapshot(core.base_url("example.com", 8787)).online is False
assert calls == []
def test_fetch_snapshot_does_not_follow_redirects_off_loopback() -> None:
import http.server
import threading
hits: list[str] = []
class Target(http.server.BaseHTTPRequestHandler):
def do_GET(self) -> None:
hits.append(self.path)
self.send_response(200)
self.end_headers()
self.wfile.write(b'{"persistent_savings": {"lifetime": {"tokens_saved": 5}}}')
def log_message(self, *args: object) -> None:
pass
target = http.server.HTTPServer(("127.0.0.1", 0), Target)
class Redirector(http.server.BaseHTTPRequestHandler):
def do_GET(self) -> None:
self.send_response(302)
self.send_header("Location", f"http://127.0.0.1:{target.server_port}/stats")
self.end_headers()
def log_message(self, *args: object) -> None:
pass
redirector = http.server.HTTPServer(("127.0.0.1", 0), Redirector)
servers = (target, redirector)
for server in servers:
threading.Thread(target=server.serve_forever, daemon=True).start()
try:
snap = core.fetch_snapshot(f"http://127.0.0.1:{redirector.server_port}", timeout=2)
finally:
for server in servers:
server.shutdown()
server.server_close()
assert snap.online is False
assert hits == []
def test_quit_requests_sigint_without_scheduling_a_hard_exit(
monkeypatch: pytest.MonkeyPatch,
) -> None:
import os
import signal
import threading
from headroom.tray import launcher
raised: list[int] = []
monkeypatch.setattr(signal, "raise_signal", raised.append)
monkeypatch.setattr(os, "_exit", lambda code: pytest.fail("hard exit must not be forced"))
monkeypatch.setattr(
threading, "Timer", lambda *a, **k: pytest.fail("no force-exit timer allowed")
)
launcher.request_graceful_shutdown()
assert raised == [signal.SIGINT]
Generated
+88 -1
View File
@@ -1909,6 +1909,10 @@ spreadsheet = [
strands = [
{ name = "strands-agents" },
]
tray = [
{ name = "pillow" },
{ name = "pystray" },
]
vector = [
{ name = "hnswlib" },
]
@@ -2000,8 +2004,10 @@ requires-dist = [
{ name = "opentelemetry-sdk", marker = "extra == 'otel'", specifier = ">=1.24.0" },
{ name = "orjson", marker = "platform_python_implementation != 'PyPy' and extra == 'proxy'", specifier = ">=3.9.14" },
{ name = "pillow", marker = "extra == 'image'", specifier = ">=12.3.0" },
{ name = "pillow", marker = "extra == 'tray'", specifier = ">=12.3.0" },
{ name = "pre-commit", marker = "extra == 'dev'", specifier = ">=3.0.0" },
{ name = "pydantic", specifier = ">=2.0.0" },
{ name = "pystray", marker = "extra == 'tray'", specifier = ">=0.19.5" },
{ name = "pytest", marker = "extra == 'dev'", specifier = ">=7.0.0" },
{ name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.21.0" },
{ name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=4.0.0" },
@@ -2048,7 +2054,7 @@ requires-dist = [
{ name = "xlwt", marker = "extra == 'dev'", specifier = ">=1.3.0" },
{ name = "zstandard", marker = "extra == 'proxy'", specifier = ">=0.20.0" },
]
provides-extras = ["proxy", "proxy-prod", "vertex", "code", "ml", "memory", "vector", "memory-stack", "pytorch-mps", "relevance", "image", "reports", "spreadsheet", "otel", "anyllm", "langchain", "langgraph", "agno", "strands", "autogen", "mcp", "voice", "voice-train", "evals", "bedrock", "redis", "html", "dev", "all", "lean", "sandbox"]
provides-extras = ["proxy", "proxy-prod", "vertex", "code", "ml", "memory", "vector", "memory-stack", "pytorch-mps", "relevance", "image", "reports", "spreadsheet", "otel", "anyllm", "langchain", "langgraph", "agno", "strands", "autogen", "mcp", "voice", "voice-train", "evals", "bedrock", "redis", "tray", "html", "dev", "all", "lean", "sandbox"]
[[package]]
name = "hf-xet"
@@ -4742,6 +4748,75 @@ crypto = [
{ name = "cryptography" },
]
[[package]]
name = "pyobjc-core"
version = "13.0"
source = { registry = "https://pypi.org/simple/" }
sdist = { url = "https://files.pythonhosted.org/packages/83/58/7bab095330b8893e1ac58f3cf9710462c3242b600f8fa5db0d5dda795775/pyobjc_core-13.0.tar.gz", hash = "sha256:ffe154462d14aa4852f424e9116f17b5f8d44f78fc0f6c4727e721a5fa7177da", size = 1083172, upload-time = "2026-10-30T10:45:39.835Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/06/ad/7151cd0f01d561a6d9e761b12cdcbb5bcf4f4e65efa619bf4afcb202df28/pyobjc_core-13.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:4627348cb31c8deb2bb94702d9bcaa74869f4fef9559fd134416a6a4ca42006e", size = 5615698, upload-time = "2026-10-30T10:32:42.051Z" },
{ url = "https://files.pythonhosted.org/packages/68/ac/783ecf1c5045792fb51ad18e0131ff64e33ed9dee9921766c14e03eb27db/pyobjc_core-13.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:5818e3d8cc2677a1e767968ebfe3bc0cb7f80c1f7c19c653ee25ef1cc1b3e188", size = 6716501, upload-time = "2026-10-30T10:32:46.2Z" },
{ url = "https://files.pythonhosted.org/packages/d8/42/7b31511491d966b64183dfab325f022098e06e90c19a9cc8540de4f32588/pyobjc_core-13.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:f29f7cdb3969268716017ada9516b94f6dd1c66c2e415274b5ac1169440da1a4", size = 6734122, upload-time = "2026-10-30T10:32:50.192Z" },
{ url = "https://files.pythonhosted.org/packages/04/54/fda17a291ecdb5186f545c9a7575d02f55815e239756567f030b555b14f3/pyobjc_core-13.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:1e8752b3950ceec603bf36f57083151abed15e0c2e7c5b8c3efded9c81dc732c", size = 7031547, upload-time = "2026-10-30T10:32:55.183Z" },
{ url = "https://files.pythonhosted.org/packages/41/a5/463dc32a6c32cff57b4678298a13cd830d7ab09cfec3d7e80f20a2f414fd/pyobjc_core-13.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:fe470bd7b8163b4b8d216b1ebe5b227f01c0fa1c4e0085d7ccade269dec02bb0", size = 6729572, upload-time = "2026-10-30T10:32:59.498Z" },
{ url = "https://files.pythonhosted.org/packages/b4/11/e57bb09924e8e0dfbaa87a9cf8da13e224189f760aa0c39ab0ce9defb0d4/pyobjc_core-13.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:c497a23077ba0a42b59b879d81049eebfb0b7b67a8ca80c68b6d3683bbbd6d6f", size = 7021797, upload-time = "2026-10-30T10:33:03.702Z" },
{ url = "https://files.pythonhosted.org/packages/43/3c/0f39ddc5ff4d1b8e38134349c4f018c47d4fbba297510561429aa6c1a2c3/pyobjc_core-13.0-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:d65d383efed5a803e43f6c67ccc9f4c94754842b2268da24319bb57a852b016f", size = 6782204, upload-time = "2026-10-30T10:33:08.125Z" },
{ url = "https://files.pythonhosted.org/packages/dd/bc/35eb48cff5d20770a2adb2bb0f01424f5dfbcc7dae8e5ecb990f6d90adf9/pyobjc_core-13.0-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:292462e0947a09aca3737a06c44457cb2aa58f267cfc581c16fca036fc073b45", size = 7036187, upload-time = "2026-10-30T10:33:12.36Z" },
]
[[package]]
name = "pyobjc-framework-cocoa"
version = "13.0"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "pyobjc-core", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/30/50/55a8779d35f1f86d795264cbd6fe62e35b2cf4fb8343fc888e99268c988a/pyobjc_framework_cocoa-13.0.tar.gz", hash = "sha256:bb7a23941fc8d7866578dbc84e56140efd343a1d28510f530dd1dbf80807daf4", size = 3135308, upload-time = "2026-10-30T10:46:03.982Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/f2/88/d8cece46725d7879aee3b6a047cbbb86e54aa51b31c707c7d8da6bffa331/pyobjc_framework_cocoa-13.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:16dd1e8890ed695ce12bcd367ed0ac9f3e70dd1f7a8098b6398427c162591b83", size = 391003, upload-time = "2026-10-30T10:35:14.969Z" },
{ url = "https://files.pythonhosted.org/packages/ea/44/98d626726809da517c757d77e2888d34eaf758ebad908effb8d0b60c8118/pyobjc_framework_cocoa-13.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e1618d315939c9fae57cb858d4db496ec61f82495ce6a877398131ee494fc19d", size = 391597, upload-time = "2026-10-30T10:35:16.217Z" },
{ url = "https://files.pythonhosted.org/packages/01/b0/cb28ff4474a2f07bb9b64751112b3b40c421755297749c70810f4cadfc24/pyobjc_framework_cocoa-13.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:bb0bcba2e4e9d05af875306e0e055cfc2f152fd602d5f2f1a54490adebebcd34", size = 391670, upload-time = "2026-10-30T10:35:17.336Z" },
{ url = "https://files.pythonhosted.org/packages/54/e6/53aeaa92fd8261ba32d7faca85bef4aa210740f4f4462d0e727be6769731/pyobjc_framework_cocoa-13.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:d6fa11ea29d85d46e65ed1c9fdba3a5131ad26971bf24bb7d16aa55f06bcdc1e", size = 395676, upload-time = "2026-10-30T10:35:18.813Z" },
{ url = "https://files.pythonhosted.org/packages/b4/bb/f683ec329180e1931c8d592c882defebca8810e019cf4bc8727fa36b7d89/pyobjc_framework_cocoa-13.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:88be6d452e7531f695ce6d41428aa74bcaade9ddbc50af592419b9f2fbb7c879", size = 391936, upload-time = "2026-10-30T10:35:20.154Z" },
{ url = "https://files.pythonhosted.org/packages/c5/3e/1b24b56d3710a594dc2350ed6b321aaf0ee12fca3dafa6034bccffc8ac08/pyobjc_framework_cocoa-13.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:1a6b9f9e0ab123e51fa7df43bbc6c0414a444facd2225ad4f221a0d842c49ad6", size = 395844, upload-time = "2026-10-30T10:35:21.319Z" },
{ url = "https://files.pythonhosted.org/packages/f2/e0/b2f89d9c92e2b6513d8495d81c3a7d6042f936f51ed7dd2180615a01c980/pyobjc_framework_cocoa-13.0-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:9282ebad57784ec18f4b7ea2e6b65bac0a6f56cc21a5c63e061fa48a9b49dd26", size = 392140, upload-time = "2026-10-30T10:35:22.562Z" },
{ url = "https://files.pythonhosted.org/packages/2c/ac/d2c8fa5d96ddf4e70ac5ddb23f24ac7861577728df342697125c1b42e159/pyobjc_framework_cocoa-13.0-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:f1e26ad2225d1c84973cce725f2f4aeeb4d5f653a36c8a9f0b691c5529dc7780", size = 396079, upload-time = "2026-10-30T10:35:23.821Z" },
]
[[package]]
name = "pyobjc-framework-quartz"
version = "13.0"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "pyobjc-core", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
{ name = "pyobjc-framework-cocoa", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/7a/86/ffaa76ca28df5450cce14614c657b910bbd7bb737feaf47f74230c3b78d3/pyobjc_framework_quartz-13.0.tar.gz", hash = "sha256:b9a4942182efbbc7e18e6cb7f5a8faa166dc2fc5e33bece7c7b1355494274add", size = 3399243, upload-time = "2026-10-30T10:47:23.667Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/b6/35/c78b8cba3da718c52f2c5022498a9b89d985b8a19cbf76fe8702b88bb719/pyobjc_framework_quartz-13.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:90630977d69975e94f49f06e7b32b5e757334d71239944ad38c3efabb73aa4ef", size = 214455, upload-time = "2026-10-30T10:42:32.886Z" },
{ url = "https://files.pythonhosted.org/packages/73/f9/be94503cc5475a076b61b65b64ccb030a2b72bf6fddbe68bae1f20d9e624/pyobjc_framework_quartz-13.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:5e1d49f2699d128553a52fad473622ff4fd424d05e879d9585dad0a9f7c3dcfd", size = 215360, upload-time = "2026-10-30T10:42:34.247Z" },
{ url = "https://files.pythonhosted.org/packages/1e/b4/d16db7d8b21e5d252a84de57bfa71fb73f09014105430525392d3b6f6c24/pyobjc_framework_quartz-13.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:f7a4fab3bb1a78640135db257f2c75277d0931bad26c500e34b88480c33dece1", size = 215890, upload-time = "2026-10-30T10:42:35.29Z" },
{ url = "https://files.pythonhosted.org/packages/98/cd/ef7a402b9b7c6ac9892812f2e59a64e5f0b132d64b6bd183e8593371f036/pyobjc_framework_quartz-13.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b94ba73bfbd1b707723c88997aaf38b2aad03d9417f6fe54f243fc583237a353", size = 221066, upload-time = "2026-10-30T10:42:36.399Z" },
{ url = "https://files.pythonhosted.org/packages/a4/4c/54f6d14e1e78543dfc146f04fc4f11897a937530cec256a487803437f137/pyobjc_framework_quartz-13.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:ea179def24ffbdd61e43e7c33a0cb2b2d79c7cb39fa8d212ab87c964702e5f87", size = 216448, upload-time = "2026-10-30T10:42:37.67Z" },
{ url = "https://files.pythonhosted.org/packages/a7/37/fa19d41d083ef2a9c763234d6338c2213ea297ffb58377f566707cca60d5/pyobjc_framework_quartz-13.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:fdba4c5d095e2f88812d0584fdb4b35dc31f38d93145830cc955f42710f1f8ec", size = 221335, upload-time = "2026-10-30T10:42:38.825Z" },
{ url = "https://files.pythonhosted.org/packages/c5/fa/11c471eb99c3a572343e86a4201e789f4076a8011f7b2c0261d9767e7149/pyobjc_framework_quartz-13.0-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:d76914284e721b96e2a7850da81343cd4af083a00d07afd87545be432d1e2e24", size = 216492, upload-time = "2026-10-30T10:42:39.935Z" },
{ url = "https://files.pythonhosted.org/packages/ae/62/cd1fc4fd3a95f7a09744ab25b315dd8c3ff0b69a18ce997a0af7ec28f1f2/pyobjc_framework_quartz-13.0-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:ab6f410ac494b63ed48294392650b88ce8229511a0eb0059458982daeeacc6f7", size = 221391, upload-time = "2026-10-30T10:42:41.015Z" },
]
[[package]]
name = "pystray"
version = "0.19.5"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "pillow" },
{ name = "pyobjc-framework-quartz", marker = "sys_platform == 'darwin'" },
{ name = "python-xlib", marker = "sys_platform == 'linux'" },
{ name = "six" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/5c/64/927a4b9024196a4799eba0180e0ca31568426f258a4a5c90f87a97f51d28/pystray-0.19.5-py2.py3-none-any.whl", hash = "sha256:a0c2229d02cf87207297c22d86ffc57c86c227517b038c0d3c59df79295ac617", size = 49068, upload-time = "2023-09-17T13:44:26.872Z" },
]
[[package]]
name = "pytest"
version = "9.0.3"
@@ -4836,6 +4911,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/b6/6e/c42bb2ed04ddb141dcba433662d21a92323ba25c2662f8b99f0a0de4a30a/python_socks-3.2.0-py3-none-any.whl", hash = "sha256:4cb349f43043eeeb12d10919cb992a7ce8671c2c5a836a47cb0c29d8def11d24", size = 49571, upload-time = "2026-10-27T14:57:10.422Z" },
]
[[package]]
name = "python-xlib"
version = "0.33"
source = { registry = "https://pypi.org/simple/" }
dependencies = [
{ name = "six", marker = "(platform_machine != 'x86_64' and sys_platform == 'darwin') or (sys_platform != 'darwin' and sys_platform != 'emscripten' and sys_platform != 'win32')" },
]
sdist = { url = "https://files.pythonhosted.org/packages/86/f5/8c0653e5bb54e0cbdfe27bf32d41f27bc4e12faa8742778c17f2a71be2c0/python-xlib-0.33.tar.gz", hash = "sha256:55af7906a2c75ce6cb280a584776080602444f75815a7aff4d287bb2d7018b32", size = 269068, upload-time = "2022-12-25T18:53:00.824Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/fc/b8/ff33610932e0ee81ae7f1269c890f697d56ff74b9f5b2ee5d9b7fa2c5355/python_xlib-0.33-py2.py3-none-any.whl", hash = "sha256:c3534038d42e0df2f1392a1b30a15a4ff5fdc2b86cfa94f072bf11b10a164398", size = 182185, upload-time = "2022-12-25T18:52:58.662Z" },
]
[[package]]
name = "pytz"
version = "2025.2"