Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Doesn't detect cycles when deep relative imports are used #14

Open
webknjaz opened this issue Feb 17, 2020 · 1 comment
Open

[BUG] Doesn't detect cycles when deep relative imports are used #14

webknjaz opened this issue Feb 17, 2020 · 1 comment

Comments

@webknjaz
Copy link

I haven't tried to debug it but it's reproducible with this version of my project: https://github.com/sanitizers/octomachinery/tree/4cd3455d6d5f62b94bd1fd2ce78658cbce3eb18a

pycycle says No worries, no cycles here! but in fact it misses some.

This is how it explodes in runtime:

$ ipython
Python 3.8.0 (default, Oct 16 2019, 16:00:06) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.11.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from octomachinery.github.api.app_client import GitHubApp                  
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-1b4597177f26> in <module>
----> 1 from octomachinery.github.api.app_client import GitHubApp

~/.pyenv/versions/chronographer-github-app-py3.8.0-pyenv-venv/lib/python3.8/site-packages/octomachinery/github/api/app_client.py in <module>
     10 
     11 # pylint: disable=relative-beyond-top-level
---> 12 from ...app.routing import WEBHOOK_EVENTS_ROUTER
     13 # pylint: disable=relative-beyond-top-level
     14 from ...app.routing.abc import OctomachineryRouterBase

~/.pyenv/versions/chronographer-github-app-py3.8.0-pyenv-venv/lib/python3.8/site-packages/octomachinery/app/__init__.py in <module>
      1 """GitHub App infra."""
      2 
----> 3 from .server.runner import run  # noqa: F401

~/.pyenv/versions/chronographer-github-app-py3.8.0-pyenv-venv/lib/python3.8/site-packages/octomachinery/app/server/runner.py in <module>
     18 from .config import WebServerConfig
     19 # pylint: disable=relative-beyond-top-level
---> 20 from .machinery import run_forever as run_server_forever
     21 
     22 

~/.pyenv/versions/chronographer-github-app-py3.8.0-pyenv-venv/lib/python3.8/site-packages/octomachinery/app/server/machinery.py in <module>
      9 
     10 # pylint: disable=relative-beyond-top-level
---> 11 from ...github.api.app_client import GitHubApp
     12 # pylint: disable=relative-beyond-top-level
     13 from ...utils.asynctools import auto_cleanup_aio_tasks

ImportError: cannot import name 'GitHubApp' from partially initialized module 'octomachinery.github.api.app_client' (most likely due to a circular import) (~/.pyenv/versions/chronographer-github-app-py3.8.0-pyenv-venv/lib/python3.8/site-packages/octomachinery/github/api/app_client.py)
@togakangaroo
Copy link

Just looking through the code and I had the same question when I couldn't understand how it was handling relative imports (which in python2 can look the same as regular imports). Seems like it doesn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants