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

Inheritance across modules doesn't work #135

Closed
Kobzol opened this issue Jul 26, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@Kobzol
Copy link

commented Jul 26, 2017

Hello :-) Pdoc correctly shows inheritance links and copies inherited docstrings for methods in a single module, but when I have classes inherited across modules, it doesn't work.

E.g.:

base.py:
class Base(object):
    def fn(self):
        """doc"""
        pass

derived.py:
from base import Base
class Derived(Base):
    def fn(self):
        pass

With this there will be no inheritance link and no inherited docstring. The inheritance chain will be displayed but it won't be clickable.

Is there a way to accomplish this? I'd make a PR if you'd point me in the direction how this could be achieved.
My original motivation was to hide inherited methods that are not overridden, because for classes with many methods they are needlessly displayed in the derived classes and it produces visual clutter.
I added it to pdoc (Kobzol@53dfee9) but then I realized that pdoc already handles inheritance and if it worked across modules it would be much easier and less hacky to do this.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2017

pdoc supports cross-module linking by generating stable identifiers and then relying on the pdoc http server to resolve them based on which modules are loaded into memory. Links are generated in templates and then resolving the links is in the server.

I don't know why this isn't already working, so you'll need to investigate. There may be dragons lurking.

@Kobzol

This comment has been minimized.

Copy link
Author

commented Jul 26, 2017

I wanted to generate a static documentation, so I'm using --html generation and thus the dynamic .ext links will not work. I'll try to see if I can resolve the module names during the generation. Basically the problem is that only classes in the current module and submodules are considered, I need to also consider the classes in parent modules.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2017

@Kobzol Sadly, you're shit-out-of-luck. :-) Cross linking isn't supported in the static mode. It's just not a problem I ever tried to solve.

@Kobzol

This comment has been minimized.

Copy link
Author

commented Jul 26, 2017

I looked at how the modules are constructed and it would require a substantial rewrite to support this, I probably won't be going into that now. Feel free to merge my commit if you think that the inherited method hiding functionality is useful. Thanks for a quick answer :-)

@Kobzol Kobzol closed this Jul 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.