INCATools / INCATools/ontology-access-kit

Using `oakx-plugin` with `oaklib` dependency greater than version 0.1.53 gives an obscure error.

Open
#394 15 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
198
Forks
35
Avg merge
3d 4h
Merged PRs (30d)
1

Description

This problem arose when @justaddcoffee , @caufieldjh and I were hacking together on `oakx-grape`.

On using `oaklib` latest version, the command `runoak -I sqlite:obo:pato terms` returns `IndexError: list index out of range` . We debugged this deep into `pkg_resources`.

The code in `oaklib` where this error is thrown is [here](https://github.com/INCATools/ontology-access-kit/blob/6f9d3200c97f00b56e5804a1b3e604d5ddfddc87/src/oaklib/implementations/__init__.py#L94):
```
implementation_resolver.register_entrypoint("oaklib.plugins")
```

On digging deeper, it goes to the area where plugins are imported (using `__import__`). Exact snippet in `pkg_resources` would be:
```
def resolve(self):
"""
Resolve the entry point from its module and attrs.
"""
module = __import__(self.module_name, fromlist=['__name__'], level=0)
try:
return functools.reduce(getattr, self.attrs, module)
except AttributeError as exc:
raise ImportError(str(exc)) from exc
```

[Something changed between v0.1.53 and v0.1.54 that may have caused this](https://github.com/INCATools/ontology-access-kit/compare/v0.1.53...v0.1.54#diff-f53a023eedfa3fbf2925ec7dc76eecdc954ea94b7e47065393dbad519613dc89). Needs further investigation.

Contributor guide

Open the contributing guide

Research direction

Start with src/oaklib/implementations/__init__.py at implementation_resolver.register_entrypoint("oaklib.plugins"), then inspect the pkg_resources EntryPoint.resolve snippet and the v0.1.53 to v0.1.54 comparison. Reproduce the failure with `runoak -I sqlite:obo:pato terms` using a newer oaklib dependency. Done means identifying the change that causes the IndexError and replacing the obscure failure with correct plugin loading or a clear error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.