From e47c63502023c7702428e9e36b23b1bcd544603e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Perceval=20Wajsb=C3=BCrt?= Date: Mon, 4 Nov 2024 18:26:37 +0100 Subject: [PATCH] fix: support docs generation (therefore tests too) in py312 --- docs/scripts/plugin.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/scripts/plugin.py b/docs/scripts/plugin.py index 3d3867967..13f65ecb7 100644 --- a/docs/scripts/plugin.py +++ b/docs/scripts/plugin.py @@ -163,6 +163,13 @@ def on_page_read_source(page, config): """ +def get_ep_namespace(ep, namespace): + if hasattr(ep, "select"): + return ep.select(group=namespace) + else: # dict + return ep.get(namespace, []) + + @mkdocs.plugins.event_priority(-1000) def on_post_page( output: str, @@ -186,11 +193,12 @@ def on_post_page( """ autorefs: AutorefsPlugin = config["plugins"]["autorefs"] + ep = entry_points() spacy_factories_entry_points = { ep.name: ep.value for ep in ( - *entry_points()["spacy_factories"], - *entry_points()["edsnlp_factories"], + *get_ep_namespace(ep, "spacy_factories"), + *get_ep_namespace(ep, "edsnlp_factories"), ) }