From 9a46450391917d20cda4b88d593941bbfb904308 Mon Sep 17 00:00:00 2001 From: star11293 Date: Sat, 30 May 2026 16:08:55 -0400 Subject: [PATCH] fix: update popmon_dp_loader_example notebook for popmon 1.0+ API popmon v1.0.0 migrated to a pydantic-based Settings model that rejects the extended_report and pull_rules kwargs the notebook was passing directly to pm_stability_report, causing a ValidationError on every run with modern popmon. Migrates the three pm_stability_report calls to use a Settings object: - extended_report moves to settings.report.extended_report - pull_rules is renamed to monitoring_rules and moves to settings.monitoring.monitoring_rules - time_axis must be set on settings.time_axis (the kwarg is ignored when settings is provided) Adds a make_settings() helper so each call gets a fresh Settings instance, since the object's bin_specs gets mutated per-call and can't be reused. Verified by running the notebook end-to-end against popmon 1.4.12. Fixes #1014 --- examples/popmon_dp_loader_example.ipynb | 28 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/examples/popmon_dp_loader_example.ipynb b/examples/popmon_dp_loader_example.ipynb index 3ddb267da..9d063dbac 100644 --- a/examples/popmon_dp_loader_example.ipynb +++ b/examples/popmon_dp_loader_example.ipynb @@ -65,7 +65,24 @@ "except ImportError:\n", " import dataprofiler as dp\n", "import pandas as pd\n", - "import popmon # noqa" + "import popmon # noqa\n", + "\n", + "from popmon import Settings\n", + "\n", + "\n", + "def make_settings(time_axis):\n", + " \"\"\"Create popmon Settings with our custom config (popmon 1.0+ API).\n", + "\n", + " A fresh Settings is needed for each pm_stability_report call because\n", + " settings.bin_specs gets mutated on each call. The time_axis must be set\n", + " on settings; the time_axis kwarg to pm_stability_report is ignored when\n", + " settings is provided.\n", + " \"\"\"\n", + " s = Settings()\n", + " s.time_axis = time_axis\n", + " s.report.extended_report = False\n", + " s.monitoring.monitoring_rules = {\"*_pull\": [10, 7, -7, -10]}\n", + " return s" ] }, { @@ -204,8 +221,7 @@ " time_axis=time_index,\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", - " pull_rules={\"*_pull\": [10, 7, -7, -10]},\n", + " settings=make_settings(time_index),\n", ")\n", "\n", "# Save popmon reports\n", @@ -234,8 +250,7 @@ " time_axis=time_index,\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", - " pull_rules={\"*_pull\": [10, 7, -7, -10]},\n", + " settings=make_settings(time_index),\n", ")\n", "\n", "# Save popmon reports\n", @@ -366,8 +381,7 @@ " time_axis=time_index,\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", - " pull_rules={\"*_pull\": [10, 7, -7, -10]},\n", + " settings=make_settings(time_index),\n", ")" ] },