Skip to content

Commit a45eac4

Browse files
authored
Fix nested load entrypoint (#89)
* move statement out of loop * add comments * add comment to the loop that affectively registers plugins new commands --------- Co-authored-by: Fabio Pliger <[email protected]>
1 parent 77b6062 commit a45eac4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/pyscript/cli.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ def main(
4545
raise typer.Exit()
4646

4747

48+
# Create the default PluginManager
4849
pm = PluginManager("pyscript")
4950

51+
# Register the hooks specifications available for PyScript Plugins
5052
pm.add_hookspecs(hookspecs)
53+
54+
# Register the default plugins available with the bare pyscript cli installation
5155
for modname in DEFAULT_PLUGINS:
5256
importspec = f"pyscript.plugins.{modname}"
5357
try:
@@ -59,7 +63,12 @@ def main(
5963
else:
6064
mod = sys.modules[importspec]
6165
pm.register(mod, modname)
62-
loaded = pm.load_setuptools_entrypoints("pyscript")
6366

67+
68+
# Load plugins registered via setuptools entrypoints
69+
loaded = pm.load_setuptools_entrypoints("pyscript")
70+
71+
# Register the commands from plugins that have been loaded and used the
72+
# `pyscript_subcommand` hook.
6473
for cmd in pm.hook.pyscript_subcommand():
6574
plugins._add_cmd(cmd)

0 commit comments

Comments
 (0)