Include component factories in third-party dependencies resolver (#9009)

* Include component factories in third-party dependencies resolver

* Increment catalogue and update test
This commit is contained in:
Ines Montani 2021-08-25 22:58:01 +10:00 committed by GitHub
parent e1f88de729
commit 4cd052e81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 2 deletions

View File

@ -8,7 +8,7 @@ ml_datasets>=0.2.0,<0.3.0
murmurhash>=0.28.0,<1.1.0
wasabi>=0.8.1,<1.1.0
srsly>=2.4.1,<3.0.0
catalogue>=2.0.4,<2.1.0
catalogue>=2.0.6,<2.1.0
typer>=0.3.0,<0.4.0
pathy>=0.3.5
# Third party dependencies

View File

@ -48,7 +48,7 @@ install_requires =
blis>=0.4.0,<0.8.0
wasabi>=0.8.1,<1.1.0
srsly>=2.4.1,<3.0.0
catalogue>=2.0.4,<2.1.0
catalogue>=2.0.6,<2.1.0
typer>=0.3.0,<0.4.0
pathy>=0.3.5
# Third-party dependencies

View File

@ -206,6 +206,9 @@ def get_third_party_dependencies(
for path, value in util.walk_dict(config):
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"])
modules = set()
for reg_name, func_names in funcs.items():
sub_registry = getattr(util.registry, reg_name)

View File

@ -539,4 +539,6 @@ def test_get_third_party_dependencies_runs():
# We can't easily test the detection of third-party packages here, but we
# can at least make sure that the function and its importlib magic runs.
nlp = Dutch()
# Test with component factory based on Cython module
nlp.add_pipe("tagger")
assert get_third_party_dependencies(nlp.config) == []