mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-01 10:23:07 +03:00
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:
parent
e1f88de729
commit
4cd052e81d
|
@ -8,7 +8,7 @@ ml_datasets>=0.2.0,<0.3.0
|
||||||
murmurhash>=0.28.0,<1.1.0
|
murmurhash>=0.28.0,<1.1.0
|
||||||
wasabi>=0.8.1,<1.1.0
|
wasabi>=0.8.1,<1.1.0
|
||||||
srsly>=2.4.1,<3.0.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
|
typer>=0.3.0,<0.4.0
|
||||||
pathy>=0.3.5
|
pathy>=0.3.5
|
||||||
# Third party dependencies
|
# Third party dependencies
|
||||||
|
|
|
@ -48,7 +48,7 @@ install_requires =
|
||||||
blis>=0.4.0,<0.8.0
|
blis>=0.4.0,<0.8.0
|
||||||
wasabi>=0.8.1,<1.1.0
|
wasabi>=0.8.1,<1.1.0
|
||||||
srsly>=2.4.1,<3.0.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
|
typer>=0.3.0,<0.4.0
|
||||||
pathy>=0.3.5
|
pathy>=0.3.5
|
||||||
# Third-party dependencies
|
# Third-party dependencies
|
||||||
|
|
|
@ -206,6 +206,9 @@ def get_third_party_dependencies(
|
||||||
for path, value in util.walk_dict(config):
|
for path, value in util.walk_dict(config):
|
||||||
if path[-1].startswith("@"): # collect all function references by registry
|
if path[-1].startswith("@"): # collect all function references by registry
|
||||||
funcs[path[-1][1:]].add(value)
|
funcs[path[-1][1:]].add(value)
|
||||||
|
for component in config.get("components", {}).values():
|
||||||
|
if "factory" in component:
|
||||||
|
funcs["factories"].add(component["factory"])
|
||||||
modules = set()
|
modules = set()
|
||||||
for reg_name, func_names in funcs.items():
|
for reg_name, func_names in funcs.items():
|
||||||
sub_registry = getattr(util.registry, reg_name)
|
sub_registry = getattr(util.registry, reg_name)
|
||||||
|
|
|
@ -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
|
# 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.
|
# can at least make sure that the function and its importlib magic runs.
|
||||||
nlp = Dutch()
|
nlp = Dutch()
|
||||||
|
# Test with component factory based on Cython module
|
||||||
|
nlp.add_pipe("tagger")
|
||||||
assert get_third_party_dependencies(nlp.config) == []
|
assert get_third_party_dependencies(nlp.config) == []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user