Switch to Python 3.13
All checks were successful
CI / Tests (Python 3.13) (push) Successful in 1m17s

The dependencies stay in the same series as on Python 3.8
where those support 3.13.

Only the unavoidable upgrades are taken:
 - `matplotlib` to v3.9
 - `numpy` to v2.1
 - `pandas` to v2.2
 - `scipy` (via statsmodels)

Required code changes:
- `numpy` v2.1 prints its scalars as `np.float64(...)`,
  which `psycopg2` then writes into the SQL
  => Adjust `Forecast.from_dataframe()` to convert the
     rounded values into plain `float`s
- Python 3.12 no longer accepts `float`s in `random.randint()`
  => The test factories now pass the seconds as `int`s

CI and `nox` use a `u`v-managed Python, which ships the C headers
needed to build `psycopg2` and `rpy2`.

`flake8` v4 does not run on Python 3.12+
and is upgraded in a future commit.
This commit is contained in:
Alexander Hess 2026-11-25 11:29:50 +01:00
commit 042256eb99
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -188,7 +188,7 @@ class Forecast(meta.Base):
for timestamp_idx in data.index:
start_at = timestamp_idx.to_pydatetime()
actual = int(data.loc[timestamp_idx, 'actual'])
prediction = round(data.loc[timestamp_idx, 'prediction'], 5)
prediction = float(round(data.loc[timestamp_idx, 'prediction'], 5))
# Explicit type casting. SQLAlchemy does not convert
# `float('NaN')`s into plain `None`s.
@ -201,22 +201,22 @@ class Forecast(meta.Base):
if math.isnan(low80):
low80 = None
else:
low80 = round(low80, 5)
low80 = float(round(low80, 5))
if math.isnan(high80):
high80 = None
else:
high80 = round(high80, 5)
high80 = float(round(high80, 5))
if math.isnan(low95):
low95 = None
else:
low95 = round(low95, 5)
low95 = float(round(low95, 5))
if math.isnan(high95):
high95 = None
else:
high95 = round(high95, 5)
high95 = float(round(high95, 5))
forecasts.append(
cls(