From 05b9961b082acaab740e6767b559660e90a8b51c Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:51:04 +0800 Subject: [PATCH] :bug: fix script select in py3.12 --- nb_cli/template/scripts/script/_entrypoint.py.jinja | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nb_cli/template/scripts/script/_entrypoint.py.jinja b/nb_cli/template/scripts/script/_entrypoint.py.jinja index 098c639..b1f7e80 100644 --- a/nb_cli/template/scripts/script/_entrypoint.py.jinja +++ b/nb_cli/template/scripts/script/_entrypoint.py.jinja @@ -1,6 +1,9 @@ {% macro get_entrypoints() %} +import sys from importlib.metadata import entry_points -entrypoints = entry_points() -entrypoints = entrypoints["{{ ENTRYPOINT_GROUP }}"] if "{{ ENTRYPOINT_GROUP }}" in entrypoints else [] +if sys.version_info < (3, 10): + entrypoints = entry_points().get({{ ENTRYPOINT_GROUP|repr }}, ()) +else: + entrypoints = entry_points(group={{ ENTRYPOINT_GROUP|repr }}) {% endmacro %}