Summary
The US model performs a live PyPI metadata lookup at import time (src/policyengine/tax_benefit_models/us/model.py:52), which breaks offline, firewalled, and sandboxed environments. The UK model handles this gracefully with a try/except fallback (src/policyengine/tax_benefit_models/uk/model.py:45).
Impact
import policyengine.tax_benefit_models.us fails without network access
- This cascades to test collection (
tests/conftest.py imports US fixtures globally), so even unit tests that don't need US model data can't run offline
- The paper's inline code example and the README smoke test both fail in no-network environments
- A JOSS reviewer flagged this as a major issue when reviewing in a sandboxed environment
Suggested fix
- Make the US metadata lookup fault-tolerant, mirroring the UK implementation pattern
- Consider lazy-loading the US model metadata (fetch on first use, not at import time)
- Move heavyweight US imports in
tests/conftest.py and tests/fixtures/filtering_fixtures.py inside test functions or fixtures so offline unit tests can still collect
References
- UK graceful handling:
src/policyengine/tax_benefit_models/uk/model.py:45
- US import-time lookup:
src/policyengine/tax_benefit_models/us/model.py:52
- Test collection dependency:
tests/conftest.py:4, tests/fixtures/filtering_fixtures.py:11
Summary
The US model performs a live PyPI metadata lookup at import time (
src/policyengine/tax_benefit_models/us/model.py:52), which breaks offline, firewalled, and sandboxed environments. The UK model handles this gracefully with a try/except fallback (src/policyengine/tax_benefit_models/uk/model.py:45).Impact
import policyengine.tax_benefit_models.usfails without network accesstests/conftest.pyimports US fixtures globally), so even unit tests that don't need US model data can't run offlineSuggested fix
tests/conftest.pyandtests/fixtures/filtering_fixtures.pyinside test functions or fixtures so offline unit tests can still collectReferences
src/policyengine/tax_benefit_models/uk/model.py:45src/policyengine/tax_benefit_models/us/model.py:52tests/conftest.py:4,tests/fixtures/filtering_fixtures.py:11