Skip to content

Docs build fails due to __getattr__ intercepting dunder attributes during Sphinx introspection #617

@Jiya873

Description

@Jiya873

While working on PR #616, I ran into a docs build failure on Read the Docs that seems unrelated to the changes in that PR.

During Sphinx autosummary generation, class introspection triggers access to __mro__, which is intercepted by pymc_extras.prior.__getattr__. This leads to:

UnsupportedDistributionError: PyMC doesn't have a distribution of name '__mro__'

This appears to happen because __getattr__ attempts to resolve unknown attributes as PyMC distributions, including Python dunder attributes that are needed for Sphinx introspection.

Error Log

File ".../site-packages/sphinx/util/inspect.py", line 317, in isstaticmethod
    for basecls in getattr(cls, '__mro__', [cls]):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../site-packages/pymc_extras/prior.py", line 1582, in __getattr__
    _get_pymc_distribution(name)
File ".../site-packages/pymc_extras/prior.py", line 246, in _get_pymc_distribution
    raise UnsupportedDistributionError(f"PyMC doesn't have a distribution of name {name!r}")
pymc_extras.prior.UnsupportedDistributionError: PyMC doesn't have a distribution of name '__mro__'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions