From 20f63e7154fe51955ab88e56e07487e7ab3c3862 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Thu, 16 Sep 2021 07:16:01 +1000 Subject: [PATCH] Only include runtime-relevant config in package CLI dependency detection (#9211) --- spacy/cli/package.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spacy/cli/package.py b/spacy/cli/package.py index 1a873d104..332a51bc7 100644 --- a/spacy/cli/package.py +++ b/spacy/cli/package.py @@ -203,9 +203,11 @@ def get_third_party_dependencies( own_packages = ("spacy", "spacy-legacy", "spacy-nightly", "thinc", "srsly") distributions = util.packages_distributions() funcs = defaultdict(set) - for path, value in util.walk_dict(config): - if path[-1].startswith("@"): # collect all function references by registry - funcs[path[-1][1:]].add(value) + # We only want to look at runtime-relevant sections, not [training] or [initialize] + for section in ("nlp", "components"): + for path, value in util.walk_dict(config[section]): + if path[-1].startswith("@"): # collect all function references by registry + funcs[path[-1][1:]].add(value) for component in config.get("components", {}).values(): if "factory" in component: funcs["factories"].add(component["factory"])