♻️ refactor: merge grid + electricity contracts into MarketMixin #194

Merged
mat merged 1 commit from refactor/merge-market into main 2026-10-27 14:35:29 +00:00
Owner

Summary

Two energy-market context mixins merge into one module and one class:

_grid.py                 ─┐
_electricity_contracts.py ─┴─► _market.py, MarketMixin
    ├── get_electricity_price · get_ecowatt
    ├── get_electricity_contract · get_electricity_contract_providers

client.py: GridMixin + ElectricityContractsMixin imports/bases → MarketMixin (16 → 15 mixins)

git mv keeps the diff minimal (rename detection 61%).

Evidence

  • Before: ecowatt/electricity-price lived in GridMixin, contracts in ElectricityContractsMixin — both energy-market reads split across two thin modules (#151 audit).
    After: one MarketMixin owns the market/tariff domain; no test references the deleted modules (verified), pytest -q → 242 passed unchanged, mypy → clean.

Merge Danger

Door: two-way

Blast Radius: none — public API unchanged (all four flat methods identical); only the client.py bases line overlaps with sibling consolidation PRs.

Closes the grid/contracts part of #176. Part of the #151 audit consolidation.

## Summary Two energy-market context mixins merge into one module and one class: ```text _grid.py ─┐ _electricity_contracts.py ─┴─► _market.py, MarketMixin ├── get_electricity_price · get_ecowatt ├── get_electricity_contract · get_electricity_contract_providers client.py: GridMixin + ElectricityContractsMixin imports/bases → MarketMixin (16 → 15 mixins) ``` `git mv` keeps the diff minimal (rename detection 61%). ## Evidence - **Before:** ecowatt/electricity-price lived in `GridMixin`, contracts in `ElectricityContractsMixin` — both energy-market reads split across two thin modules (#151 audit). **After:** one `MarketMixin` owns the market/tariff domain; no test references the deleted modules (verified), `pytest -q` → 242 passed unchanged, `mypy` → clean. ## Merge Danger **Door:** two-way **Blast Radius:** none — public API unchanged (all four flat methods identical); only the `client.py` bases line overlaps with sibling consolidation PRs. Closes the grid/contracts part of #176. Part of the #151 audit consolidation.
♻️ refactor: merge grid + electricity contracts into MarketMixin
All checks were successful
Tests / forgejo-pytest (push) Successful in 44s
Tests / forgejo-pytest (pull_request) Successful in 44s
99ae3758eb
mat changed title from WIP: ♻️ refactor: merge grid + electricity contracts into MarketMixin to ♻️ refactor: merge grid + electricity contracts into MarketMixin 2026-10-27 14:35:16 +00:00
mat force-pushed refactor/merge-market from 99ae3758eb
All checks were successful
Tests / forgejo-pytest (push) Successful in 44s
Tests / forgejo-pytest (pull_request) Successful in 44s
to 9466c73370
All checks were successful
Tests / forgejo-pytest (push) Successful in 44s
Tests / forgejo-pytest (pull_request) Successful in 43s
2026-10-27 14:35:18 +00:00
Compare
mat merged commit 3c15e4e90c into main 2026-10-27 14:35:29 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mat/python-comwatt-client!194
No description provided.