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 %}