Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting git_link_template causes failures on property and cached_property #450

Open
mivanit opened this issue Aug 19, 2024 · 0 comments
Open

Comments

@mivanit
Copy link

mivanit commented Aug 19, 2024

Expected Behavior

pdoc should successfully build docs with git_link_template = 'https://github.com/USER/PROJECT/blob/{commit}/{path}#L{start_line}-L{end_line}' for classes with property or cached_property

Actual Behavior

Python/Lib/site-packages/pdoc/html_helpers.py:580: UserWarning: format_git_link for <functools.cached_property object at ...> failed:
Traceback (most recent call last):
  File "Python/Lib/site-packages/pdoc/html_helpers.py", line 567, in format_git_link
    abs_path = inspect.getfile(inspect.unwrap(dobj.obj))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Python/Lib/inspect.py", line 929, in getfile
    raise TypeError('module, class, method, function, traceback, frame, or '
TypeError: module, class, method, function, traceback, frame, or code object was expected, got cached_property

  warn(f'format_git_link for {dobj.obj} failed:\n{traceback.format_exc()}')

Steps to Reproduce

  1. create a python module with a class with a property or cached_property
  2. create a config.mako with git_link_template not None
  3. run pdoc on the module with the config.mako in the templates dir

Additional info

  • pdoc version: 0.11.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant