forked from conda-forge/jupyter-book-feedstock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/jupyter_book/cli/pluggable.py b/jupyter_book/cli/pluggable.py | ||
index 113608a..24dabd4 100644 | ||
--- a/jupyter_book/cli/pluggable.py | ||
+++ b/jupyter_book/cli/pluggable.py | ||
@@ -3,18 +3,18 @@ from typing import Any, Iterable, List, Set | ||
|
||
import click | ||
|
||
-try: | ||
- from importlib import metadata | ||
-except ImportError: | ||
- import importlib_metadata as metadata | ||
+if __import__("sys").version_info < (3, 10): | ||
+ from importlib_metadata import entry_points | ||
+else: | ||
+ from importlib.metadata import entry_points | ||
|
||
|
||
def get_entry_point_names(group: str) -> List[str]: | ||
- return [ep.name for ep in metadata.entry_points().get(group, [])] | ||
+ return [ep.name for ep in entry_points(group=group)] | ||
|
||
|
||
def load_entry_point(group: str, name: str) -> Any: | ||
- eps = [ep for ep in metadata.entry_points().get(group, []) if ep.name == name] | ||
+ eps = [ep for ep in entry_points(group=group) if ep.name == name] | ||
if not eps: | ||
raise KeyError(f"Entry-point {group}:{name}") | ||
return eps[0].load() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters