From 343cbc905f43a61bbb873ac2de1679032be00a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 11:52:52 +0200 Subject: [PATCH 1/3] Package requiring pyomo >= 6.8.0 This allows to work with numpy >= 2.0.0. --- docs/changelog.rst | 1 + docs/whatsnew/v0-5-5.rst | 12 ++++++++++++ pyproject.toml | 4 ++-- src/oemof/solph/__init__.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 docs/whatsnew/v0-5-5.rst diff --git a/docs/changelog.rst b/docs/changelog.rst index 63c0c0356..7f0fe3d06 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,6 +9,7 @@ These are new features and improvements of note in each release :backlinks: top +.. include:: whatsnew/v0-5-5.rst .. include:: whatsnew/v0-5-4.rst .. include:: whatsnew/v0-5-3.rst .. include:: whatsnew/v0-5-2.rst diff --git a/docs/whatsnew/v0-5-5.rst b/docs/whatsnew/v0-5-5.rst new file mode 100644 index 000000000..2bef736a8 --- /dev/null +++ b/docs/whatsnew/v0-5-5.rst @@ -0,0 +1,12 @@ +v0.5.5 () +-------------------------- + +Bug fixes +######### + +* Update required Pyomo version to allow working with numpy >= 2.0.0. + +Contributors +############ + +* Patrik Schönfeldt diff --git a/pyproject.toml b/pyproject.toml index 60f422d70..7626d8049 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,9 +57,9 @@ requires-python = ">=3.8" dependencies = [ "blinker", "dill", - "numpy < 2.0.0", + "numpy", "pandas >= 2.0.0", - "pyomo >= 6.6.0, < 7.0", + "pyomo >= 6.8.0", "networkx", "oemof.tools >= 0.4.3", "oemof.network >= 0.5.0", diff --git a/src/oemof/solph/__init__.py b/src/oemof/solph/__init__.py index ebdb22c2c..679f9bd05 100644 --- a/src/oemof/solph/__init__.py +++ b/src/oemof/solph/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.5.4" +__version__ = "0.5.5b1" from . import buses from . import components From 39717e5ffdb71da019c103ad469b753f2332072f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 12:16:36 +0200 Subject: [PATCH 2/3] Require up-to-date Pandas It's almost impossible to have doctests that work with both, numpy 1.x and numpy 2.x. Introducin a lower bound to Pandas as well allows to remove Pandas <2.2 compatibility code. --- pyproject.toml | 4 ++-- src/oemof/solph/_energy_system.py | 10 +--------- src/oemof/solph/_plumbing.py | 6 +++--- src/oemof/solph/flows/_flow.py | 2 +- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7626d8049..d50b4de2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,8 +57,8 @@ requires-python = ">=3.8" dependencies = [ "blinker", "dill", - "numpy", - "pandas >= 2.0.0", + "numpy >= 2.0.0", + "pandas >= 2.2.0", "pyomo >= 6.8.0", "networkx", "oemof.tools >= 0.4.3", diff --git a/src/oemof/solph/_energy_system.py b/src/oemof/solph/_energy_system.py index 79681ad04..51f02dc35 100644 --- a/src/oemof/solph/_energy_system.py +++ b/src/oemof/solph/_energy_system.py @@ -302,13 +302,5 @@ def create_time_index( number = round(hoy / interval) if start is None: start = f"1/1/{year}" - try: - time_index = pd.date_range( - start, periods=number + 1, freq=f"{interval}h" - ) - except ValueError: - # Pandas <2.2 compatibility - time_index = pd.date_range( - start, periods=number + 1, freq=f"{interval}H" - ) + time_index = pd.date_range(start, periods=number + 1, freq=f"{interval}h") return time_index diff --git a/src/oemof/solph/_plumbing.py b/src/oemof/solph/_plumbing.py index bb6ed5b80..50b7e28cb 100644 --- a/src/oemof/solph/_plumbing.py +++ b/src/oemof/solph/_plumbing.py @@ -30,15 +30,15 @@ def sequence(iterable_or_scalar): -------- >>> y = sequence([1,2,3,4,5,6,7,8,9,10,11]) >>> y[0] - 1 + np.int64(1) >>> y[10] - 11 + np.int64(11) >>> import pandas as pd >>> s1 = sequence(pd.Series([1,5,9])) >>> s1[2] - 9 + np.int64(9) >>> x = sequence(10) >>> x[0] diff --git a/src/oemof/solph/flows/_flow.py b/src/oemof/solph/flows/_flow.py index 6ed8e97ab..2189512f2 100644 --- a/src/oemof/solph/flows/_flow.py +++ b/src/oemof/solph/flows/_flow.py @@ -111,7 +111,7 @@ class Flow(Edge): >>> f.variable_costs[2] 5 >>> f.fix[2] - 4 + np.int64(4) Creating a flow object with time-depended lower and upper bounds: From 599946d94861898e922881c26c576596e007153e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Tue, 15 Oct 2024 16:58:51 +0200 Subject: [PATCH 3/3] Change to upload-artifact@v4 (GH CI) --- .github/workflows/packaging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index d53aa82b8..a09540cfe 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -34,7 +34,7 @@ jobs: run: python -m build . - name: Run twine check run: twine check dist/* - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: tox-gh-actions-dist path: dist