Skip to content

Depend on policyengine[uk] instead of flooring policyengine-uk separately - #77

Open
vahid-ahmadi wants to merge 1 commit into
PSLmodels:mainfrom
vahid-ahmadi:deps/policyengine-uk-extra
Open

Depend on policyengine[uk] instead of flooring policyengine-uk separately#77
vahid-ahmadi wants to merge 1 commit into
PSLmodels:mainfrom
vahid-ahmadi:deps/policyengine-uk-extra

Conversation

@vahid-ahmadi

@vahid-ahmadi vahid-ahmadi commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Why

The standalone policyengine-uk>=2.89.2 floor looks like it controls the model version. It doesn't.

uk_latest — passed as tax_benefit_model_version in _get_micro_data (api.py:378) — reads the version from policyengine's bundled manifest, not from the installed policyengine-uk. So the independent floor cannot raise the version OG-UK simulates against; it only lets the installed rules drift away from the manifest.

With policyengine==5.0.4 and policyengine-uk==2.93.1, both admitted today, pip resolves happily and every import works — but:

UserWarning: Installed policyengine-uk version (2.93.1) does not match the
bundled policyengine.py manifest (2.90.2). ... dataset compatibility is not guaranteed.

>>> uk_latest.version
'2.90.2'

policyengine-core drifts the same way (3.31.1 installed vs the 3.30.1 the extra pins).

What changes after merging

A fresh unlocked install can no longer land mismatched rules against the manifest — the extra pins them together. policyengine is also capped below 6, where before >=4.22 silently admitted the 4.x→5.x major bump.

Nothing moves in practice: uv.lock is unchanged. It already resolved to 5.0.4 / 3.30.1 / 2.90.2, so CI has been testing this combination all along and only the declaration was loose.

Change

-    "policyengine>=4.22",
-    "policyengine-uk>=2.89.2",
+    "policyengine[uk]>=5.0,<6",

Nothing in oguk/ imports policyengine_uk directly, so the country package is an implementation detail of policyengine.

Evidence

Fresh install of policyengine[uk]>=5.0,<6:

installed pe-uk  : 2.90.2
uk_latest.version: 2.90.2
mismatch warnings: NONE
all imports OK

Not verified: a full calibration run against 5.x — that needs microdata I don't have locally and CI doesn't exercise a solve. Since uv.lock is unchanged this shouldn't move any resolved version, but a maintainer confirming one calibrate() before merge would be worth it.

Fixes #74.

…tely

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 PSLmodels#74

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XCKMb1aicxYaeUC1us2nvF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PolicyEngine dependencies: policyengine-uk floored independently of the version policyengine pins, and policyengine>=4.22 admits 5.x uncapped

1 participant