From ac7d0b90b57f3b0070bd537c93db9354243b7841 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 25 Jan 2026 08:23:10 -0500 Subject: [PATCH 1/3] Bump policyengine-core to 3.23.5 for pandas 3.0 compatibility Co-Authored-By: Claude Opus 4.5 --- changelog_entry.yaml | 4 ++++ setup.py | 1 + 2 files changed, 5 insertions(+) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..58659269 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + changed: + - Bumped policyengine-core minimum version to 3.23.5 for pandas 3.0 compatibility diff --git a/setup.py b/setup.py index 3c31fd68..8de66df8 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ install_requires=[ "anthropic", "Authlib>=1.3.1", + "policyengine-core>=3.23.5", "cloud-sql-python-connector", "flask>=2.2", "flask-cors>=3", From 280e1471a2a7daeba27e7a338775d98c6e107210 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 25 Jan 2026 08:32:14 -0500 Subject: [PATCH 2/3] Add test for pandas 3.0 enum encoding compatibility Follows TDD approach by adding a test that verifies policyengine-core's Enum.encode works correctly with pandas Series, which was broken in pandas 3.0 due to removal of core.internals.blocks.ExtensionBlock. Co-Authored-By: Claude Opus 4.5 --- tests/test_pandas3_compatibility.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_pandas3_compatibility.py diff --git a/tests/test_pandas3_compatibility.py b/tests/test_pandas3_compatibility.py new file mode 100644 index 00000000..8c013218 --- /dev/null +++ b/tests/test_pandas3_compatibility.py @@ -0,0 +1,19 @@ +"""Test pandas 3.0 compatibility with enum encoding.""" +import pandas as pd +from policyengine_core.enums import Enum + + +class SampleEnum(Enum): + VALUE_A = "value_a" + VALUE_B = "value_b" + + +def test_enum_encode_with_pandas_series(): + """Test that Enum.encode works with pandas Series.""" + enum_items = [SampleEnum.VALUE_A, SampleEnum.VALUE_B, SampleEnum.VALUE_A] + series = pd.Series(enum_items) + + encoded = SampleEnum.encode(series) + + assert len(encoded) == 3 + assert list(encoded) == [0, 1, 0] From 9ce38ad1118e1b104f3e18868414bc640097c454 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 25 Jan 2026 09:15:38 -0500 Subject: [PATCH 3/3] Fix black 24.3.0 formatting in test file Co-Authored-By: Claude Opus 4.5 --- tests/test_pandas3_compatibility.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_pandas3_compatibility.py b/tests/test_pandas3_compatibility.py index 8c013218..98481aa1 100644 --- a/tests/test_pandas3_compatibility.py +++ b/tests/test_pandas3_compatibility.py @@ -1,4 +1,5 @@ """Test pandas 3.0 compatibility with enum encoding.""" + import pandas as pd from policyengine_core.enums import Enum @@ -12,8 +13,8 @@ def test_enum_encode_with_pandas_series(): """Test that Enum.encode works with pandas Series.""" enum_items = [SampleEnum.VALUE_A, SampleEnum.VALUE_B, SampleEnum.VALUE_A] series = pd.Series(enum_items) - + encoded = SampleEnum.encode(series) - + assert len(encoded) == 3 assert list(encoded) == [0, 1, 0]