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
Describe the bug
Native namespace packages (without __init__.py modules) trigger the following kind of error when attempting to retrieve the top package's path:
ERROR - mkdocstrings.handlers.python: Collection failed: <module 'bot' (namespace)> is a built-in module
Traceback (most recent call last):
File "/home/dadyarri/projects/bjorn/venv_bjorn/lib/python3.8/site-packages/pytkdocs/cli.py", line 179, in main
print(json.dumps(process_json(line)))
File "/home/dadyarri/projects/bjorn/venv_bjorn/lib/python3.8/site-packages/pytkdocs/cli.py", line 116, in process_json
return process_config(json.loads(json_input))
File "/home/dadyarri/projects/bjorn/venv_bjorn/lib/python3.8/site-packages/pytkdocs/cli.py", line 98, in process_config
serialized_obj = serialize_object(obj)
File "/home/dadyarri/projects/bjorn/venv_bjorn/lib/python3.8/site-packages/pytkdocs/serializer.py", line 143, in serialize_object
relative_file_path=obj.relative_file_path,
File "/home/dadyarri/projects/bjorn/venv_bjorn/lib/python3.8/site-packages/pytkdocs/objects.py", line 185, in relative_file_path
top_package_path = Path(inspect.getabsfile(top_package)).parent
File "/usr/lib/python3.8/inspect.py", line 720, in getabsfile
_filename = getsourcefile(object) or getfile(object)
File "/usr/lib/python3.8/inspect.py", line 696, in getsourcefile
filename = getfile(object)
File "/usr/lib/python3.8/inspect.py", line 659, in getfile
raise TypeError('{!r} is a built-in module'.format(object))
TypeError: <module 'bot' (namespace)> is a built-in module
To Reproduce
Simply try to collect documentation for a native namespace package.
Expected behavior
No exception. We should find another way to determine the top package's path in that case.
I have a solution based on iterating from the top path down till we find a non-namespace package and using that, but it won't work well if the namespace package is further in. Making a test for this is going to be a giant pain.
Native namespace packages don't have an `__init__.py` module.
This commit adds support for finding relative file path
of such packages.
References: #19, #22.
Native namespace packages don't have an `__init__.py` module.
This commit adds support for finding relative file path
of such packages.
References: #19, #22.
Describe the bug
Native namespace packages (without
__init__.py
modules) trigger the following kind of error when attempting to retrieve the top package's path:To Reproduce
Simply try to collect documentation for a native namespace package.
Expected behavior
No exception. We should find another way to determine the top package's path in that case.
Reference: mkdocstrings/mkdocstrings#79 (comment)
The text was updated successfully, but these errors were encountered: