Skip to content

Conversation

@MSK-005
Copy link

@MSK-005 MSK-005 commented Jan 5, 2026

Description

This PR (for #7861) adds a function create_scalar_dims_docstrings() that copies the docstrings from all relevant classes in pymc.distributions.continuous to pymc.dims.distributions.scalar, replacing "tensor_like" with "xtensor_like" where applicable.

Related Issue

  • Closes #7861
  • Related to #

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@MSK-005 MSK-005 changed the title Added function to copy docstrings Add Docstrings for pymc.dims.distributions.scalar Jan 5, 2026
@MSK-005
Copy link
Author

MSK-005 commented Jan 8, 2026

@ricardoV94, looking forward to your code review.

Comment on lines 207 to 212
# Get all subclasses of Continuous class
imported_dists = {
name: cls
for name, cls in inspect.getmembers(_regular_dists, inspect.isclass)
if issubclass(cls, Continuous) and cls is not Continuous
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small performance idea: I guess we can get dims_dists first and do a more targetted filter (matches name -> is a subclass of Distribution)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ricardoV94 ricardoV94 requested a review from OriolAbril January 13, 2026 17:12
@ricardoV94
Copy link
Member

return super().dist([alpha, beta], **kwargs)


def create_scalar_dims_docstrings():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to rethink again.

What if instead we use a decorator on the specific classes or manually do Univariate.__doc__ = foo(regular_dists.Univariate.__doc__)? So we don't need to loop and try to guess what goes with what. This also avoids accidentally overriding custom docstrings if we add them in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants