diff --git a/spacy/cli/_util.py b/spacy/cli/_util.py index 0ecb5ad8f..ee83ec75e 100644 --- a/spacy/cli/_util.py +++ b/spacy/cli/_util.py @@ -13,7 +13,7 @@ from thinc.config import Config, ConfigValidationError from configparser import InterpolationError from ..schemas import ProjectConfigSchema, validate -from ..util import import_file, run_command, make_tempdir +from ..util import import_file, run_command, make_tempdir, registry if TYPE_CHECKING: from pathy import Pathy # noqa: F401 @@ -54,6 +54,8 @@ app.add_typer(init_cli) def setup_cli() -> None: + # Make sure the entry-point for CLI runs, so that they get imported. + registry.cli.get_all() # Ensure that the help messages always display the correct prompt command = get_command(app) command(prog_name=COMMAND) diff --git a/spacy/util.py b/spacy/util.py index fa4815df8..bd567ddc7 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -93,6 +93,7 @@ class registry(thinc.registry): # environment. spaCy models packaged with `spacy package` will "advertise" # themselves via entry points. models = catalogue.create("spacy", "models", entry_points=True) + cli = catalogue.create("spacy", "cli", entry_points=True) class SimpleFrozenDict(dict):