explosion / catalogue

Super lightweight function registries for your library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get functions from registry if entry points only points to the correct module and not to the specific functions

NixBiks opened this issue · comments

I'm getting this extremely odd error that tells me chain.v1 is not available while it is showing up as available name at the same time.

catalogue.RegistryError: Cant't find 'chain.v1' in registry horizon -> components. Available names: Pipeline.v1, _, chain.v1, fetch.v1, response_to_bytes.v1, response_to_dict.v1, response_to_text.v1

I've tried to run my test in debug mode with a break point where the error occurs. If I run Registry.get then it fails as in the test but if I run Registry.get() a second time then it works.

Reason

In Registry.get() we only look for the specific name, i.e. from_entry_point = self.get_entry_point(name) or in the global variable REGISTRY. It doesn't exist in either in the first run. But in the second run it does exist in REGISTRY since we called Registry.get_entry_points() to print the error message, since this method actually load all the modules in the entry points and thereby populates REGISTRY.

Proposed solution

Load all modules from entry points in Registry.get() if there is entry points but the requested one is found directly.

Are you still running into issues related to this? We haven't had any other related reports and without any tests, I'm a little hesitant about the changes in #13.