diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..be5bddf5 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + fixed: + - Fixed `format_fig` to work with Python 3.11. diff --git a/policyengine/utils/charts.py b/policyengine/utils/charts.py index ad830d63..6575c1e3 100644 --- a/policyengine/utils/charts.py +++ b/policyengine/utils/charts.py @@ -1,5 +1,6 @@ import plotly.graph_objects as go from IPython.core.display import HTML, display_html +from policyengine.utils.packages import get_country_package_version def add_fonts(): @@ -42,12 +43,6 @@ def add_fonts(): ] -def get_version_number(package): - import importlib - - return importlib.import_module(package).__version__ - - def format_fig( fig: go.Figure, country: str = "uk", add_zero_line: bool = False ) -> go.Figure: @@ -97,7 +92,7 @@ def format_fig( ) ) - version = get_version_number(f"policyengine-{country}") + version = get_country_package_version(country) # Add bottom left chart description opposite logo fig.add_annotation(