Switch to Python 3.13
All checks were successful
CI / Tests (Python 3.13) (push) Successful in 1m17s
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:
parent
34da92102f
commit
042256eb99
6 changed files with 436 additions and 8619 deletions
|
|
@ -15,7 +15,7 @@ defaults:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Tests (Python 3.8)
|
name: Tests (Python 3.13)
|
||||||
runs-on: debian-13
|
runs-on: debian-13
|
||||||
|
|
||||||
# Throwaway database, reachable from the job as host `postgres`
|
# Throwaway database, reachable from the job as host `postgres`
|
||||||
|
|
@ -52,12 +52,12 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
"$HOME/.local/bin/uv" python install 3.8
|
"$HOME/.local/bin/uv" python install 3.13
|
||||||
"$HOME/.local/bin/uv" tool install --python 3.13 'poetry>=2'
|
"$HOME/.local/bin/uv" tool install --python 3.13 'poetry>=2'
|
||||||
|
|
||||||
- name: Install the project
|
- name: Install the project
|
||||||
run: |
|
run: |
|
||||||
uv venv --python 3.8 --seed .venv
|
uv venv --python 3.13 --seed .venv
|
||||||
poetry sync --no-interaction
|
poetry sync --no-interaction
|
||||||
|
|
||||||
# `TESTING=true` comes from `setup.cfg`
|
# `TESTING=true` comes from `setup.cfg`
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ SRC_LOCATIONS = (
|
||||||
PYTEST_LOCATION,
|
PYTEST_LOCATION,
|
||||||
)
|
)
|
||||||
|
|
||||||
PYTHON = '3.8'
|
PYTHON = '3.13'
|
||||||
|
|
||||||
# Use a unified .cache/ folder for all tools.
|
# Use a unified .cache/ folder for all tools.
|
||||||
nox.options.envdir = '.cache/nox'
|
nox.options.envdir = '.cache/nox'
|
||||||
|
|
|
||||||
8693
poetry.lock
generated
8693
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -24,25 +24,25 @@ license = "MIT"
|
||||||
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
requires-python = ">=3.8,<4.0"
|
requires-python = ">=3.13,<4.0"
|
||||||
|
|
||||||
|
|
||||||
# Package => Code developed in *.py files and packaged under src/velofy
|
# Package => Code developed in *.py files and packaged under src/velofy
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Shapely>=1.7.1,<3",
|
"Shapely>=1.7.1,<2.1",
|
||||||
"alembic>=1.4.2,<2",
|
"alembic>=1.4.2,<1.15",
|
||||||
"click>=7.1.2,<9",
|
"click>=7.1.2,<8.2",
|
||||||
"folium>=0.12.1,<1",
|
"folium>=0.12.1,<0.19",
|
||||||
"geopy>=2.1.0,<3",
|
"geopy>=2.1.0,<3",
|
||||||
"googlemaps>=4.4.2,<5",
|
"googlemaps>=4.4.2,<5",
|
||||||
"matplotlib>=3.3.3,<4",
|
"matplotlib>=3.3.3,<3.10",
|
||||||
"ordered-set>=4.0.2,<5",
|
"ordered-set>=4.0.2,<5",
|
||||||
"pandas>=1.1.0,<3",
|
"pandas>=1.1.0,<2.3",
|
||||||
"psycopg2>=2.8.5,<3", # Adapter for PostgreSQL
|
"psycopg2>=2.8.5,<3", # Adapter for PostgreSQL
|
||||||
"rpy2>=3.4.1,<4",
|
"rpy2>=3.4.1,<4",
|
||||||
"sqlalchemy>=1.3.18,<3",
|
"sqlalchemy>=1.3.18,<2.1",
|
||||||
"statsmodels>=0.12.1,<0.15",
|
"statsmodels>=0.12.1,<0.15",
|
||||||
"utm>=0.7.0,<1",
|
"utm>=0.7.0,<0.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ dependencies = [
|
||||||
# `jupyter lab` => Notebooks with analyses using the developed package
|
# `jupyter lab` => Notebooks with analyses using the developed package
|
||||||
research = [
|
research = [
|
||||||
"jupyterlab>=2.2.2",
|
"jupyterlab>=2.2.2",
|
||||||
"numpy>=1.19.1",
|
"numpy>=1.19.1,<2.2",
|
||||||
"pytz>=2020.1",
|
"pytz>=2020.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -82,32 +82,32 @@ skip-string-normalization = true # `wemake-python-styleguide` enforces single q
|
||||||
|
|
||||||
# Task Runners
|
# Task Runners
|
||||||
nox = ">=2020.5.24"
|
nox = ">=2020.5.24"
|
||||||
pre-commit = ">=2.6.0"
|
pre-commit = ">=2.6.0,<3.6"
|
||||||
|
|
||||||
# Code Formatters
|
# Code Formatters
|
||||||
autoflake = ">=1.3.1"
|
autoflake = ">=1.3.1,<2"
|
||||||
black = ">=19.10b0"
|
black = ">=19.10b0,<25"
|
||||||
isort = ">=4.3.21"
|
isort = ">=4.3.21,<6"
|
||||||
|
|
||||||
# Code Analyzers
|
# Code Analyzers
|
||||||
flake8 = ">=3.8.3"
|
flake8 = ">=3.8.3,<5"
|
||||||
flake8-annotations = ">=2.3.0"
|
flake8-annotations = ">=2.3.0,<3"
|
||||||
flake8-black = ">=0.2.1"
|
flake8-black = ">=0.2.1,<0.4"
|
||||||
flake8-pytest-style = ">=1.2.2"
|
flake8-pytest-style = ">=1.2.2,<2"
|
||||||
mypy = ">=0.782"
|
mypy = ">=0.782,<1.15"
|
||||||
wemake-python-styleguide = ">=0.14.1" # `flake8` plug-in
|
wemake-python-styleguide = ">=0.14.1,<0.18" # `flake8` plug-in
|
||||||
|
|
||||||
# Test Suite
|
# Test Suite
|
||||||
Faker = ">=5.0.1"
|
Faker = ">=5.0.1,<36"
|
||||||
factory-boy = ">=3.1.0"
|
factory-boy = ">=3.1.0,<3.4"
|
||||||
geopy = "^2.1.0"
|
geopy = "^2.1.0"
|
||||||
packaging = ">=20.4" # Used to test the packaged version
|
packaging = ">=20.4" # Used to test the packaged version
|
||||||
pytest = ">=6.0.1"
|
pytest = ">=6.0.1,<9"
|
||||||
pytest-cov = ">=2.10.0"
|
pytest-cov = ">=2.10.0,<6"
|
||||||
pytest-env = ">=0.6.2"
|
pytest-env = ">=0.6.2,<1.2"
|
||||||
pytest-mock = ">=3.5.1"
|
pytest-mock = ">=3.5.1,<3.15"
|
||||||
xdoctest = { version=">=0.13.0", extras=["optional"] }
|
xdoctest = { version=">=0.13.0", extras=["optional"] }
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
sphinx = ">=3.1.2"
|
sphinx = ">=3.1.2,<7.2"
|
||||||
sphinx-autodoc-typehints = ">=1.11.0"
|
sphinx-autodoc-typehints = ">=1.11.0,<2.1"
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ class Forecast(meta.Base):
|
||||||
for timestamp_idx in data.index:
|
for timestamp_idx in data.index:
|
||||||
start_at = timestamp_idx.to_pydatetime()
|
start_at = timestamp_idx.to_pydatetime()
|
||||||
actual = int(data.loc[timestamp_idx, 'actual'])
|
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
|
# Explicit type casting. SQLAlchemy does not convert
|
||||||
# `float('NaN')`s into plain `None`s.
|
# `float('NaN')`s into plain `None`s.
|
||||||
|
|
@ -201,22 +201,22 @@ class Forecast(meta.Base):
|
||||||
if math.isnan(low80):
|
if math.isnan(low80):
|
||||||
low80 = None
|
low80 = None
|
||||||
else:
|
else:
|
||||||
low80 = round(low80, 5)
|
low80 = float(round(low80, 5))
|
||||||
|
|
||||||
if math.isnan(high80):
|
if math.isnan(high80):
|
||||||
high80 = None
|
high80 = None
|
||||||
else:
|
else:
|
||||||
high80 = round(high80, 5)
|
high80 = float(round(high80, 5))
|
||||||
|
|
||||||
if math.isnan(low95):
|
if math.isnan(low95):
|
||||||
low95 = None
|
low95 = None
|
||||||
else:
|
else:
|
||||||
low95 = round(low95, 5)
|
low95 = float(round(low95, 5))
|
||||||
|
|
||||||
if math.isnan(high95):
|
if math.isnan(high95):
|
||||||
high95 = None
|
high95 = None
|
||||||
else:
|
else:
|
||||||
high95 = round(high95, 5)
|
high95 = float(round(high95, 5))
|
||||||
|
|
||||||
forecasts.append(
|
forecasts.append(
|
||||||
cls(
|
cls(
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ def random_timespan( # noqa:WPS211
|
||||||
"""A randomized `timedelta` object between the specified arguments."""
|
"""A randomized `timedelta` object between the specified arguments."""
|
||||||
total_min_seconds = min_hours * 3600 + min_minutes * 60 + min_seconds
|
total_min_seconds = min_hours * 3600 + min_minutes * 60 + min_seconds
|
||||||
total_max_seconds = max_hours * 3600 + max_minutes * 60 + max_seconds
|
total_max_seconds = max_hours * 3600 + max_minutes * 60 + max_seconds
|
||||||
return dt.timedelta(seconds=random.randint(total_min_seconds, total_max_seconds))
|
return dt.timedelta(
|
||||||
|
seconds=random.randint(int(total_min_seconds), int(total_max_seconds))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def early_in_the_morning():
|
def early_in_the_morning():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue