You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our larger application runs fine when running normally, and that other pdoc3 tool has no issues. So it is definitely something that pdoc is doing differently than the rest. When commenting out references to GitPython in our larger application, pdoc then runs successfully across our entire package.
Warn: Error loading test_package:
Traceback (most recent call last):
File "/home/cquick/test/venv/lib/python3.10/site-packages/git/__init__.py", line 87, in <module>
refresh()
File "/home/cquick/test/venv/lib/python3.10/site-packages/git/__init__.py", line 78, in refresh
if not FetchInfo.refresh():
File "/home/cquick/test/venv/lib/python3.10/site-packages/git/remote.py", line 304, in refresh
if Git().version_info[:2] >= (2, 10):
File "/home/cquick/test/venv/lib/python3.10/site-packages/git/cmd.py", line 679, in version_info
return self._version_info
File "/home/cquick/test/venv/lib/python3.10/site-packages/git/cmd.py", line 638, in __getattr__
return LazyMixin.__getattr__(self, name)
File "/home/cquick/test/venv/lib/python3.10/site-packages/gitdb/util.py", line 253, in __getattr__
self._set_cache_(attr)
File "/home/cquick/test/venv/lib/python3.10/site-packages/git/cmd.py", line 659, in _set_cache_
version_numbers = process_version.split(' ')[2]
IndexError: list index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/cquick/test/venv/lib/python3.10/site-packages/pdoc/extract.py", line 207, in load_module
return importlib.import_module(module)
File "/home/cquick/.pyenv/versions/3.10.6/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/cquick/test/test_package/__init__.py", line 1, in <module>
import git
File "/home/cquick/test/venv/lib/python3.10/site-packages/git/__init__.py", line 89, in <module>
raise ImportError('Failed to initialize: {0}'.format(exc)) from exc
ImportError: Failed to initialize: list index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/cquick/test/venv/lib/python3.10/site-packages/pdoc/extract.py", line 250, in walk_packages2
module = load_module(mod.name)
File "/home/cquick/.pyenv/versions/3.10.6/lib/python3.10/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/cquick/test/venv/lib/python3.10/site-packages/pdoc/extract.py", line 209, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing test_package
(/home/cquick/test/venv/lib/python3.10/site-packages/pdoc/extract.py:252)
pdoc server ready at http://localhost:8080
This is because GitPython invokes git version on import, wheras pdoc by default suppresses all side effects. I've whitelisted git now so that things should work again. 😃
Problem Description
pdoc is unable to import package that uses GitPython.
We've noticed this issue in a large application, and I have created a minimal example that has been able to reproduce the issue here: https://github.com/cquick01/pdoc-test
Our larger application runs fine when running normally, and that other
pdoc3
tool has no issues. So it is definitely something thatpdoc
is doing differently than the rest. When commenting out references to GitPython in our larger application,pdoc
then runs successfully across our entire package.Steps to reproduce the behavior:
System Information
Paste the output of "pdoc --version" here.
Will try to provide more info if needed.
The text was updated successfully, but these errors were encountered: