Skip to content

Commit

Permalink
support python 3.11 and 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
asnyv committed Jan 26, 2024
1 parent 1ef352d commit fb66a3d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions webviz_config/themes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from importlib.metadata import entry_points

from .. import WebvizConfigTheme
Expand All @@ -7,11 +8,22 @@

__all__ = ["installed_themes"]

for entry_point in entry_points(group="webviz_config_themes"):
theme = entry_point.load()
if sys.version_info < (3,7,0):
for entry_point in entry_points().get("webviz_config_themes", []):
theme = entry_point.load()

globals()[entry_point.name] = theme
__all__.append(entry_point.name)
globals()[entry_point.name] = theme
__all__.append(entry_point.name)

if isinstance(theme, WebvizConfigTheme):
installed_themes[theme.theme_name] = theme
if isinstance(theme, WebvizConfigTheme):
installed_themes[theme.theme_name] = theme

else:
for entry_point in entry_points(group="webviz_config_themes"):
theme = entry_point.load()

globals()[entry_point.name] = theme
__all__.append(entry_point.name)

if isinstance(theme, WebvizConfigTheme):
installed_themes[theme.theme_name] = theme

0 comments on commit fb66a3d

Please sign in to comment.