pdoc icon indicating copy to clipboard operation
pdoc copied to clipboard

Link is not working when class is included in `__all__`

Open nathanthorpe opened this issue 1 year ago • 0 comments

Problem Description

Links are not working when a class is included in __all__.

Steps to reproduce the behavior:

Create the following files:

test_package/client.py

from test_package.models import Data


class Client:
    def get_data(self) -> Data:
        return Data()

test_package/models/init.py

from test_package.models.data import Data

__all__ = [
    "Data"
]

test_package/models/data.py

class Data:
    pass

Run pdoc test_package

Notice the link to the Data class is not present. image

The link works fine if you remove the contents of test_package/models/init.py and change the import to from test_package.models.data import Data.

System Information

pdoc: 14.4.0
Python: 3.11.3
Platform: Windows-10-10.0.22621-SP0

Possible fix

If render_helpers.linkify is changed to what is in this PR, then it displays the link properly (it also removes the .data path from the import

image

nathanthorpe avatar Feb 21 '24 23:02 nathanthorpe