diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..ff243af8 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + changed: + - Update PolicyEngine US to 1.562.3 diff --git a/policyengine_api/constants.py b/policyengine_api/constants.py index 81892ccf..677314d6 100644 --- a/policyengine_api/constants.py +++ b/policyengine_api/constants.py @@ -1,5 +1,5 @@ from pathlib import Path -import pkg_resources +from importlib.metadata import distributions from datetime import datetime REPO = Path(__file__).parents[1] @@ -18,11 +18,12 @@ "policyengine_il", ) try: + _dist_versions = {d.metadata["Name"]: d.version for d in distributions()} COUNTRY_PACKAGE_VERSIONS = { - country: pkg_resources.get_distribution(package_name).version + country: _dist_versions.get(package_name.replace("_", "-"), "0.0.0") for country, package_name in zip(COUNTRIES, COUNTRY_PACKAGE_NAMES) } -except: +except Exception: COUNTRY_PACKAGE_VERSIONS = {country: "0.0.0" for country in COUNTRIES} # Valid region types for each country diff --git a/policyengine_api/country.py b/policyengine_api/country.py index 68028016..33e0b00e 100644 --- a/policyengine_api/country.py +++ b/policyengine_api/country.py @@ -11,7 +11,7 @@ ParameterScaleBracket, ) from policyengine_core.parameters import get_parameter -import pkg_resources +from importlib.metadata import version as get_package_version from policyengine_core.model_api import Reform, Enum from policyengine_core.periods import instant import dpath @@ -60,9 +60,9 @@ def build_metadata(self): }[self.country_id], basicInputs=self.tax_benefit_system.basic_inputs, modelled_policies=self.tax_benefit_system.modelled_policies, - version=pkg_resources.get_distribution( - self.country_package_name - ).version, + version=get_package_version( + self.country_package_name.replace("_", "-") + ), ) def build_microsimulation_options(self) -> dict: diff --git a/setup.py b/setup.py index 5465cd8c..691ffdb2 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ "policyengine-ng==0.5.1", "policyengine-il==0.1.0", "policyengine_uk==2.39.0", - "policyengine_us==1.550.1", + "policyengine_us==1.562.3", "policyengine_core>=3.16.6", "policyengine>=0.7.0", "pydantic",