Skip to content

Commit

Permalink
chore: improve documentation for loading plugins from setuptools entr…
Browse files Browse the repository at this point in the history
…y_points
  • Loading branch information
pwwang committed Jul 19, 2024
1 parent 0c75633 commit b097ef5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion simplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,14 @@ def load_entrypoints(
group: str | None = None,
only: str | Iterable[str] = (),
) -> None:
"""Load plugins from setuptools entry_points"""
"""Load plugins from setuptools entry_points
Args:
group: The group of the entry_points
only: The names of the entry_points to load. If it's a str, it
means only load this entry_point. If it's a list of str, it
means load all the entry_points in the list.
"""
group = group or self.project

if isinstance(only, str):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ def hook(arg):
f"{sys.executable} {plugin_dir}/setup.py "
f"install --install-lib {install_dir} 1>/dev/null 2>/dev/null"
)
simplug.load_entrypoints(only="None")
simplug.load_entrypoints(only="None") # Nothing loaded
assert simplug.hooks.hook(1) == [1]

simplug.load_entrypoints()
Expand Down

0 comments on commit b097ef5

Please sign in to comment.