File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from pathlib import Path
2- import pkg_resources
2+ from importlib . metadata import distributions
33from datetime import datetime
44
55REPO = Path (__file__ ).parents [1 ]
1818 "policyengine_il" ,
1919)
2020try :
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
Original file line number Diff line number Diff line change 1111 ParameterScaleBracket ,
1212)
1313from policyengine_core .parameters import get_parameter
14- import pkg_resources
14+ from importlib . metadata import version as get_package_version
1515from policyengine_core .model_api import Reform , Enum
1616from policyengine_core .periods import instant
1717import 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 :
You can’t perform that action at this time.
0 commit comments