Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upModule loaded more than once? #50
Comments
KMouratidis
referenced this issue
Apr 22, 2019
Open
Recommended way to create own Docs for Dash apps? #696
This comment has been minimized.
This comment has been minimized.
|
Possible to get a full, reproducible mwe (including requirements)? I'd opine |
This comment has been minimized.
This comment has been minimized.
|
Fair point. MWE, two files in the same directory.
and
(Edit: actually running the app or not with Then using the cli: Click to expand full traceback
Versions (pdoc is 0.5.3 as mentioned above, python 3.6.6, GCC 8.0.1 20180414):
|
This comment has been minimized.
This comment has been minimized.
|
Thanks. Added the prints for you. I think I understand the problem:
pdoc first tries to import the CLI-specified module (app.py) with I'm not sure what to do about it. |
kernc
added
the
help wanted
label
Apr 24, 2019
This comment has been minimized.
This comment has been minimized.
|
I am not sure about it either, I can only write about a few things I tried but there will probably be more noise rather information. Anyway, here goes nothing: Of course commenting these out at least creates the html for the single file, but it doesn't work for the whole project. Sadly, even manually trying to use pdoc-cli on every file doesn't succeed for a significant number of files, with more or less errors of the same nature: Example Traceback
Of course it could be me not handling the project structure correctly, since the MWE now works. Directory tree of actual project
However it also fails when I'm trying to do use pdoc-cli on the MWE directory. Directory tree of MWE
All that said, I did notice something of potential interest: it is imports within the python modules that break pdoc. For example here is a truncated version of a problematic module:
It turns out removing this line |
This comment has been minimized.
This comment has been minimized.
|
Anyhow, don't fret too much as this probably is a Dash-only issue. Monkey-patching the app.callback to do no validation, along with manually calling pdoc on every file ( |
kernc
added this to the 0.6.0 milestone
Apr 30, 2019
kernc
added
bug
and removed
help wanted
labels
Apr 30, 2019
kernc
referenced this issue
May 3, 2019
Merged
Improved module importing / support for namespace packages #62
This comment has been minimized.
This comment has been minimized.
|
No, no, no, this should work! Welcome to test PR #62 as it contains importing improvements that might make a difference for you. |
This comment has been minimized.
This comment has been minimized.
|
Thanks! It works! I've also added a few packages and modules in the MWE and it works correctly as well. I can't seem to get it to work with my project due to some import error: A folder (
Complete traceback
Is this because of relative imports? It seems some libraries (e.g. networkx) have the same issue, while others don't (e.g. pickle, quandl, dash). |
This comment has been minimized.
This comment has been minimized.
|
Fixed in the last commit added to the PR (a3d0f25). |
This comment has been minimized.
This comment has been minimized.
|
Nice! It works correctly now! Thanks once again :) |
KMouratidis
closed this
May 3, 2019
This comment has been minimized.
This comment has been minimized.
|
Thank you for the help! |
KMouratidis commentedApr 22, 2019
•
edited
Expected Behavior
Module is not loaded more than once (?)
Actual Behavior
Module seems to be loaded multiple times, thus throwing an error due to libraries used.
Steps to Reproduce
I have a Plotly/Dash application that works fine on its own but when I try to use pdoc it raises a Dash exception that only occurs when you attempt to output to the same component multiple times:
I know this is not the case because normally the application works. This particular element isn't tampered with anyhere else in the project, so the file I'm trying to output docs for must be loaded twice.
Edit: Functions are usually wrapped with decorators that reference the top-level app (in a separate file, as per the Dash docs).
Example callback:
Additional info
Running using the cli, (e.g.
pdoc --html app.py)Running the app is protected withing a
if __name__ ....block.