pdoc3 is a nice tool to generate documentation from code. In one of my projects, I got some exception. Wonder if it is caused by project structure. These are the folder structure of my two projects.
proj_A
-src
-automation
-hl7ctl
(has a definition of HL7CtlClient)
proj_B
-src
-automation
-connctl
-core.py
-utility.py (uses HL7CtlClient)
In the utility.py of the proj_B, I have to import a class from project_A
from automation.hl7ctl import HL7CtlClient
This causes the following error by running pdoc3 at src folder in proj_B. The proj_A has been installed by using 'sudo pip3 install proje_A.gz'
automation.connctl.core No module named 'automation.hl7ctl' in pdoc3's code:
(See https://github.com/pdoc3/pdoc/blob/master/pdoc/init.py#L519)
Traceback (most recent call last):
File "/usr/local/bin/pdoc3", line 11, in <module>
load_entry_point('pdoc3==0.5.5.dev13+g43f28dd.d20190427', 'console_scripts', 'pdoc3')()
File "/usr/local/lib/python3.6/dist-packages/pdoc3-0.5.5.dev13+g43f28dd.d20190427-py3.6.egg/pdoc/cli.py", line 419, in main
for module in args.modules]
File "/usr/local/lib/python3.6/dist-packages/pdoc3-0.5.5.dev13+g43f28dd.d20190427-py3.6.egg/pdoc/cli.py", line 419, in <listcomp>
for module in args.modules]
File "/usr/local/lib/python3.6/dist-packages/pdoc3-0.5.5.dev13+g43f28dd.d20190427-py3.6.egg/pdoc/__init__.py", line 943, in __init__
m, docfilter=docfilter, supermodule=self, context=self._context)
File "/usr/local/lib/python3.6/dist-packages/pdoc3-0.5.5.dev13+g43f28dd.d20190427-py3.6.egg/pdoc/__init__.py", line 943, in __init__
m, docfilter=docfilter, supermodule=self, context=self._context)
File "/usr/local/lib/python3.6/dist-packages/pdoc3-0.5.5.dev13+g43f28dd.d20190427-py3.6.egg/pdoc/__init__.py", line 940, in __init__
m = import_module(fullname)
File "/usr/local/lib/python3.6/dist-packages/pdoc3-0.5.5.dev13+g43f28dd.d20190427-py3.6.egg/pdoc/__init__.py", line 520, in import_module
raise ValueError('File or module {!r} not found'.format(module))
ValueError: File or module 'automation.connctl.core' not found
This is how I run pdoc3:
cd src
pdoc3 --overwrite --html --html-dir ../docs/APIs --template-dir ../docs/templates automation
There are __init__.py
in automation and its subfolders but not 'src'.
The automation/__init__.py
has the following content:
__import__("pkg_resources").declare_namespace(__name__)