Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
fixed:
- Fixed `format_fig` to work with Python 3.11.
9 changes: 2 additions & 7 deletions policyengine/utils/charts.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down
Loading