🗑️ Deprecate the two *-time-ago aggregation methods #44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "deprecate-time-ago"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Soft-deprecates the two legacy aggregation aliases in favour of their current-spelling replacements:
get_site_networks_ts_time_ago→get_site_time_seriesget_site_consumption_breakdown_time_ago→get_top_consumptionBoth legacy methods now emit a
DeprecationWarning(withstacklevel=2, so it points at the caller) but are otherwise unchanged: same endpoints (site-networks-ts-time-ago/consumption-breakdown-time-ago, both still returning200live), same defaults, same response shape. Nothing is removed — existing callers (e.g. the Home Assistant integration) keep working without changes.Why not just delete them / re-point them at the new endpoints? Because the new methods have different defaults (
aggregation_levelNONE→HOUR,time_ago_unitHOUR→DAY), so delegating would silently change behaviour for callers relying on defaults. A pure soft-deprecation is zero-risk.Changes
comwatt_client/_aggregations.py:warnings.warn(..., DeprecationWarning, stacklevel=2)at the top of both methods + a.. deprecated::docstring note.tests/test_aggregations.py: two new tests asserting the warning category/message and that behaviour (endpoint + returned data) is unchanged; the existing legacy-method tests get a per-test@pytest.mark.filterwarnings("ignore::DeprecationWarning")so the project's globalfilterwarnings = errorpolicy stays intact everywhere else.README.md: both methods flagged Deprecated in the feature list; usage example switched toget_site_time_series/get_top_consumption.Not included (by request)
Test plan
pytest→ 94 passed (2 new).mypy comwatt_client→ clean.filterwarnings = errorkept globally; only the legacy-method tests opt out.Opened as a draft (WIP) — mark ready for review when you're happy.
WIP: 🗑️ Deprecate the two *-time-ago aggregation methodsto 🗑️ Deprecate the two *-time-ago aggregation methods