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

Link is not working when class is included in __all__ #669

Open
nathanthorpe opened this issue Feb 21, 2024 · 0 comments
Open

Link is not working when class is included in __all__ #669

nathanthorpe opened this issue Feb 21, 2024 · 0 comments
Labels

Comments

@nathanthorpe
Copy link

nathanthorpe commented Feb 21, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant