pdoc3 / pdoc3/pdoc

RuntimeError: absolute path '.../dataclasses.py' is not a descendant of the current working directory or of the system's python library

Open
#456 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.2k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

Hi.

In fpdf2 we have been using pdoc3 for several years:
thank you for maintaining this great tool!

I noticed a warning in our execution log:
https://github.com/py-pdf/fpdf2/actions/runs/13482969652/job/37670544099?pr=1374

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/pdoc/html_helpers.py", line 569, in format_git_link
    path = _project_relative_path(abs_path)
  File "/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/pdoc/html_helpers.py", line 635, in _project_relative_path
    raise RuntimeError(
    ...<2 lines>...
    )
RuntimeError: absolute path '/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/dataclasses.py' is not a descendant of the current working directory or of the system's python library.

I do not quite understand the origin of this stacktrace,
but I suspect that's maybe due to this usage of dataclasses.replace as a method:
https://github.com/py-pdf/fpdf2/blob/2.8.2/fpdf/fonts.py#L75

Do you know how we could prevent this error to be raised?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pdoc/html_helpers.py at format_git_link and _project_relative_path, around lines 569 and 635, then reproduce the report using the linked fpdf2 dataclasses.replace usage. Trace why dataclasses.py is resolved outside the project and verify that documenting fpdf2 no longer raises this RuntimeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.