From 4b23d3969b83afb14b70eab15c72b0913a24e676 Mon Sep 17 00:00:00 2001 From: vahid-ahmadi Date: Sat, 29 Aug 2026 13:19:57 +0100 Subject: [PATCH] Depend on policyengine[uk] instead of flooring policyengine-uk separately policyengine-uk was declared independently as >=2.89.2 with no upper bound, alongside policyengine>=4.22. That combination is unsound in a way that is easy to miss: `uk_latest` -- which _get_micro_data passes as tax_benefit_model_version -- reports the version from policyengine's bundled manifest, not from the installed policyengine-uk. So raising the standalone floor cannot raise the model version actually simulated against; it only decouples the installed rules from the manifest. With policyengine==5.0.4 and policyengine-uk==2.93.1 (both resolvable under the old declaration) the imports all work, but: UserWarning: Installed policyengine-uk version (2.93.1) does not match the bundled policyengine.py manifest (2.90.2). Calculations will run against the installed version, but dataset compatibility is not guaranteed. >>> uk_latest.version '2.90.2' policyengine-core drifted too (3.31.1 installed against the 3.30.1 the uk extra pins). Depending on the extra keeps all three in lockstep by construction. Nothing in oguk/ imports policyengine_uk directly, so the country package is an implementation detail of policyengine. Also caps the umbrella package below 6, rather than leaving the previous open-ended >=4.22 which silently admitted the 4.x -> 5.x major bump. uv.lock is unchanged: it already resolved to 5.0.4 / 3.30.1 / 2.90.2, so CI was testing this combination -- the declaration was the loose part. Refs #74 Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XCKMb1aicxYaeUC1us2nvF --- pyproject.toml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 438e34d..b3749d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,13 @@ dependencies = [ # branch), breaking calibrate(); cap until oguk migrates to the # income-heterogeneity API. "ogcore>=0.15.6,<0.18", - "policyengine>=4.22", - "policyengine-uk>=2.89.2", + # Depend on the umbrella package's uk extra rather than flooring + # policyengine-uk separately: `uk_latest` reports the version from + # policyengine's bundled manifest, not the installed package, so an + # independent floor cannot raise the model version actually simulated + # against -- it only decouples the two and downgrades the mismatch to + # a UserWarning. The extra keeps them in lockstep. + "policyengine[uk]>=5.0,<6", "requests>=2.31", "rich>=13.0", "openpyxl>=3.1",