Skip to content

Commit 5622516

Browse files
authored
Merge pull request #3230 from PolicyEngine/bump-policyengine-us-to-1.562.3
Update PolicyEngine US to 1.562.3
2 parents 6e6c098 + 1957e8e commit 5622516

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: patch
2+
changes:
3+
changed:
4+
- Update PolicyEngine US to 1.562.3

policyengine_api/constants.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
import pkg_resources
2+
from importlib.metadata import distributions
33
from datetime import datetime
44

55
REPO = Path(__file__).parents[1]
@@ -18,11 +18,12 @@
1818
"policyengine_il",
1919
)
2020
try:
21+
_dist_versions = {d.metadata["Name"]: d.version for d in distributions()}
2122
COUNTRY_PACKAGE_VERSIONS = {
22-
country: pkg_resources.get_distribution(package_name).version
23+
country: _dist_versions.get(package_name.replace("_", "-"), "0.0.0")
2324
for country, package_name in zip(COUNTRIES, COUNTRY_PACKAGE_NAMES)
2425
}
25-
except:
26+
except Exception:
2627
COUNTRY_PACKAGE_VERSIONS = {country: "0.0.0" for country in COUNTRIES}
2728

2829
# Valid region types for each country

policyengine_api/country.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
ParameterScaleBracket,
1212
)
1313
from policyengine_core.parameters import get_parameter
14-
import pkg_resources
14+
from importlib.metadata import version as get_package_version
1515
from policyengine_core.model_api import Reform, Enum
1616
from policyengine_core.periods import instant
1717
import dpath
@@ -60,9 +60,9 @@ def build_metadata(self):
6060
}[self.country_id],
6161
basicInputs=self.tax_benefit_system.basic_inputs,
6262
modelled_policies=self.tax_benefit_system.modelled_policies,
63-
version=pkg_resources.get_distribution(
64-
self.country_package_name
65-
).version,
63+
version=get_package_version(
64+
self.country_package_name.replace("_", "-")
65+
),
6666
)
6767

6868
def build_microsimulation_options(self) -> dict:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"policyengine-ng==0.5.1",
2626
"policyengine-il==0.1.0",
2727
"policyengine_uk==2.39.0",
28-
"policyengine_us==1.550.1",
28+
"policyengine_us==1.562.3",
2929
"policyengine_core>=3.16.6",
3030
"policyengine>=0.7.0",
3131
"pydantic",

0 commit comments

Comments
 (0)