Turbogears2 migration: tests: "cannot import name meta"

Mads Kiilerich mads at kiilerich.com
Sat Sep 24 22:48:14 UTC 2016


On 09/25/2016 12:17 AM, Mads Kiilerich wrote:
> The error goes like:
>
> E     File "/home/madski/kallithea-tg2/kallithea/tests/conftest.py", 
> line 12, in <module>
> E       from kallithea.model.user import UserModel
> E     File "/home/madski/kallithea-tg2/kallithea/model/__init__.py", 
> line 48, in <module>
> E       from kallithea.model import meta
> E     File "/home/madski/kallithea-tg2/kallithea/model/meta.py", line 
> 21, in <module>
> E       from kallithea.lib import caching_query
> E     File "/home/madski/kallithea-tg2/kallithea/lib/__init__.py", 
> line 27, in <module>
> E       from . import helpers
> E     File "/home/madski/kallithea-tg2/kallithea/lib/helpers.py", line 
> 56, in <module>
> E       from kallithea.lib.utils import repo_name_slug, get_custom_lexer
> E     File "/home/madski/kallithea-tg2/kallithea/lib/utils.py", line 
> 50, in <module>
> E       from kallithea.model import meta
>
> So again, we have a recursive dependency. Random changes can influence 
> whether that works or not.
>
> Removing more imports from __init__ would be a good start ... though 
> not necessarily sufficient to remove recursive imports.

We should clarify whether lib depends on model or the other way around.

I guess lib should be low level and all references to model should move 
out of lib.

Parts of kallithea/lib/utils.py should probably move to something like 
kallithea/model/utils.py .

kallithea/model/meta.py should perhaps move to lib ... unless all uses 
of it should move to the suggested new model utils.

/Mads


More information about the kallithea-general mailing list