bndr / bndr/pycycle

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

Aperta
#14 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
363
Fork
24
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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-traceback
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)
in
----> 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
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
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
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
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)
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.