Skip to content

Add docstring and type hints to DistributionMeta #5353

@canyon289

Description

@canyon289
Member

Description of your problem

Please add more documentation to DistributionMeta. This code block controls the logic for basically all distributions but its unclear what exactly its doing, or why.

For example whats cls_dict, how is it created, why is it needed?
https://github.com/pymc-devs/pymc/blob/main/pymc/distributions/distribution.py#L76

Note: This not a beginner issue, one of the core devs should do it to ensure its fully descriptive and contains all nuances

Activity

changed the title [-]Add docstring and type hints to Distribution Meta[/-] [+]Add docstring and type hints to DistributionMeta[/+] on Jan 14, 2022
canyon289

canyon289 commented on Jan 14, 2022

@canyon289
MemberAuthor

With some googling I'm realizing that clsdict seems to be some convention for ABCMeta functionality. Nonetheless I think we should still document it in PyMC for these following reasons

  1. It doesnt seem to be a common pattern so im not finding many examples
  2. This portion of the code is loaded with tons of "hardcore" python functionality, from Metaclasses to use of __new__ overwrite, to singledispatch
  3. A lot of this then references other libraries like AePPL, in particular using design choices that aren't immediately obvious

The subset of people in the world that have enough stats knowledge to contribute to PyMC, know Python well enough to know what each individual line does, and know the design patterns of PyMC, AePPL, and Aesara is very small. I'm definitely not one of them :)

Documentation will go a long way to help make this critical part of the library less challenging to understand!

https://programtalk.com/python-examples/abc.ABCMeta.__init__/

ricardoV94

ricardoV94 commented on Jan 14, 2022

@ricardoV94
Member

See #5308

OriolAbril

OriolAbril commented on Mar 3, 2022

@OriolAbril
Member

It looks like this was addressed already. Can it be closed?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @canyon289@OriolAbril@ricardoV94

        Issue actions

          Add docstring and type hints to DistributionMeta · Issue #5353 · pymc-devs/pymc