diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index dbd9423b..9c7b2ecf 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/python:1-3.8-buster +FROM mcr.microsoft.com/devcontainers/python:0-3.11 COPY .devcontainer/setup.sh requirements.txt requirements_webserver.txt ./ RUN ./setup.sh diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index c441988c..0bb5c307 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -32,8 +32,8 @@ jobs: - name: Special dependencies for macos run: | brew install hdf5 - pip3 install numpy==1.22.2 - pip3 install tables==3.7.0 + pip3 install numpy==1.26.0 + pip3 install tables==3.9.1 if: ${{ matrix.os == 'macos-latest' }} - name: Install dependencies diff --git a/docs/requirements.txt b/docs/requirements.txt index 6de14f6d..12b8bb8b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,7 @@ wheel -numpy==1.22.2 -pandas==1.4.1 -scipy<1.9.0 +numpy==1.26.0 +pandas==2.0.3 +scipy==1.11.3 pvlib>=0.10.1 protobuf>=3.0.0 pytz>=2021.1 @@ -9,7 +9,7 @@ requests>=2.25.1 beautifulsoup4>=4.9.3 pulp>=2.4 pyyaml>=5.4.1 -tables==3.7.0 +tables==3.9.1 skforecast==0.11.0 markupsafe==2.1.3 Jinja2<3.2 diff --git a/pyproject.toml b/pyproject.toml index 39cf224f..c4c17fcf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] # These are the assumed default build requirements from pip: # https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support -requires = ["setuptools==40.8.0", "wheel"] +requires = ["setuptools>=62.0.0", "wheel"] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 457273d6..01ffc923 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ wheel -numpy==1.22.2 -pandas==1.4.1 -scipy<1.9.0 +numpy==1.26.0 +pandas==2.0.3 +scipy==1.11.3 pvlib>=0.10.1 protobuf>=3.0.0 pytz>=2021.1 @@ -9,5 +9,5 @@ requests>=2.25.1 beautifulsoup4>=4.9.3 pulp>=2.4 pyyaml>=5.4.1 -tables==3.7.0 -skforecast==0.11.0 +tables==3.9.1 +skforecast==0.11.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 2f867d73..d827b9b6 100644 --- a/setup.py +++ b/setup.py @@ -37,12 +37,12 @@ keywords='energy, management, optimization, hass', # Optional package_dir={'': 'src'}, # Optional packages=find_packages(where='src'), # Required - python_requires='>=3.9, <=3.10', + python_requires='>=3.9, <3.12', install_requires=[ 'wheel', - 'numpy==1.22.2', - 'scipy<1.9.0', - 'pandas==1.4.1', + 'numpy==1.26', + 'scipy==1.11.3', + 'pandas==2.0.3', 'pvlib>=0.10.1', 'protobuf>=3.0.0', 'pytz>=2021.1', @@ -50,7 +50,7 @@ 'beautifulsoup4>=4.9.3', 'pulp>=2.4', 'pyyaml>=5.4.1', - 'tables==3.7.0', + 'tables==3.9.1', 'skforecast==0.11.0', ], # Optional entry_points={ # Optional diff --git a/src/emhass/retrieve_hass.py b/src/emhass/retrieve_hass.py index eab6b82b..6e8a2aef 100644 --- a/src/emhass/retrieve_hass.py +++ b/src/emhass/retrieve_hass.py @@ -131,8 +131,8 @@ def get_data(self, days_list: pd.date_range, var_list: list, minimal_response: O self.logger.error("Retrieved empty Dataframe, check that correct day or variable names are passed") self.logger.error("Either the names of the passed variables are not correct or days_to_retrieve is larger than the recorded history of your sensor (check your recorder settings)") if i == 0: # Defining the DataFrame container - from_date = pd.to_datetime(df_raw['last_changed']).min() - to_date = pd.to_datetime(df_raw['last_changed']).max() + from_date = pd.to_datetime(df_raw['last_changed'], format="ISO8601").min() + to_date = pd.to_datetime(df_raw['last_changed'], format="ISO8601").max() ts = pd.to_datetime(pd.date_range(start=from_date, end=to_date, freq=self.freq), format='%Y-%d-%m %H:%M').round(self.freq) df_day = pd.DataFrame(index = ts) @@ -140,7 +140,7 @@ def get_data(self, days_list: pd.date_range, var_list: list, minimal_response: O df_tp = df_raw.copy()[['state']].replace( ['unknown', 'unavailable', ''], np.nan).astype(float).rename(columns={'state': var}) # Setting index, resampling and concatenation - df_tp.set_index(pd.to_datetime(df_raw['last_changed']), inplace=True) + df_tp.set_index(pd.to_datetime(df_raw['last_changed'], format="ISO8601"), inplace=True) df_tp = df_tp.resample(self.freq).mean() df_day = pd.concat([df_day, df_tp], axis=1) diff --git a/tests/test_retrieve_hass.py b/tests/test_retrieve_hass.py index 35553747..e2d4597e 100644 --- a/tests/test_retrieve_hass.py +++ b/tests/test_retrieve_hass.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import datetime import unittest import requests_mock import numpy as np, pandas as pd @@ -100,7 +101,7 @@ def test_get_data_mock(self): self.assertIsInstance(self.rh.df_final.index.dtype, pd.core.dtypes.dtypes.DatetimeTZDtype) self.assertEqual(len(self.rh.df_final.columns), len(var_list)) self.assertEqual(self.rh.df_final.index.freq, self.retrieve_hass_conf['freq']) - self.assertEqual(self.rh.df_final.index.tz, pytz.UTC) + self.assertEqual(self.rh.df_final.index.tz, datetime.timezone.utc) def test_prepare_data(self): self.assertIsInstance(self.rh.df_final, type(pd.DataFrame()))