Skip to content

Bump python from 3.13-alpine to 3.14-alpine#277

Draft
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/docker/python-3.14-alpine
Draft

Bump python from 3.13-alpine to 3.14-alpine#277
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/docker/python-3.14-alpine

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 25, 2026

Bumps python from 3.13-alpine to 3.14-alpine.

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps python from 3.13-alpine to 3.14-alpine.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.14-alpine
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file docker Pull requests that update docker code labels Feb 25, 2026
@MaStr MaStr self-requested a review February 25, 2026 12:43
@MaStr
Copy link
Owner

MaStr commented Mar 9, 2026

Python 3.14 Upgrade — Required Code Changes

Upgrading to Python 3.14 is not a simple Dockerfile bump. Python 3.14 introduces breaking changes that affect this codebase. Here is a summary of what needs to be fixed before this PR can be merged.

1. asyncio.get_event_loop() now raises RuntimeError (HIGH priority)

In Python 3.14, calling asyncio.get_event_loop() when no event loop is running raises RuntimeError instead of silently creating a new loop. This was a DeprecationWarning since 3.10, but is now a hard error.

Affected files:

  • src/batcontrol/forecastconsumption/forecast_homeassistant.py (lines 175, 679)
  • src/batcontrol/forecastsolar/forecast_homeassistant_ml.py (lines 144, 318)
  • tests/batcontrol/forecastconsumption/test_homeassistant.py (line 980)

Pattern to replace:

# OLD — breaks on 3.14:
try:
    loop = asyncio.get_event_loop()
except RuntimeError:
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
result = loop.run_until_complete(some_coroutine())


# NEW — works on 3.9 through 3.14:
result = asyncio.run(some_coroutine())

Special case: _fetch_bulk_data() in forecast_homeassistant.py (line 679) uses a persistent WebSocket connection across multiple run_until_complete() calls in a loop. This needs to be refactored into a single async method that is then called once via asyncio.run(). This is the most involved change.

2. Compatibility with Python 3.9+

asyncio.run() has been available since Python 3.7, so all replacements are fully backward-compatible with the currently supported Python versions (3.9+). No version-conditional code is needed.

3. Other Python 3.14 changes (no impact on this codebase)

The following Python 3.14 breaking changes were reviewed and found to have no impact on batcontrol:

  • Removal of ast.Num, ast.Str, etc. — not used
  • Removal of pkgutil.find_loader() / get_loader() — not used
  • Multiprocessing default start method change to forkserver — not used
  • NotImplemented in boolean context raises TypeError — not used
  • asyncio child watcher removal — not used

Summary

Task Effort Files
Replace get_event_loop() + run_until_complete() with asyncio.run() Small forecast_homeassistant_ml.py, test_homeassistant.py
Refactor _fetch_bulk_data() to single async entry point Medium forecast_homeassistant.py
Update CI matrix to include 3.14 Small .github/workflows/

The Dockerfile bump alone is not sufficient — the asyncio changes must be applied first, otherwise the HomeAssistant consumption forecast and ML solar forecast will crash at runtime.

@MaStr MaStr marked this pull request as draft March 9, 2026 18:07
@MaStr MaStr removed their request for review March 9, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file docker Pull requests that update docker code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant