mirror of https://github.com/explosion/spaCy.git
Add CLI registry (#6037)
This commit is contained in:
parent
d98ae9d918
commit
b470062153
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue