pymc icon indicating copy to clipboard operation
pymc copied to clipboard

Consolidate typing for `coords`

Open williambdean opened this issue 3 weeks ago • 4 comments

coords have a mix of types in the codebase. Some places:

https://github.com/pymc-devs/pymc/blob/4ad7fa8f88525fae096886fb7a7b19247a7c5176/pymc/model/core.py?plain=1#L458

The conversion type:

https://github.com/pymc-devs/pymc/blob/4ad7fa8f88525fae096886fb7a7b19247a7c5176/pymc/model/core.py?plain=1#L911-L914

https://github.com/pymc-devs/pymc/blob/4ad7fa8f88525fae096886fb7a7b19247a7c5176/pymc/model/core.py?plain=1#L1065

https://github.com/pymc-devs/pymc/blob/4ad7fa8f88525fae096886fb7a7b19247a7c5176/pymc/backends/arviz.py?plain=1#L126

Seems to be a mix of Sequence and Sequence | np.ndarray so some consolidation would be nice. For example, there is already a various amount of typing for other objects like dims and shape:

https://github.com/pymc-devs/pymc/blob/4ad7fa8f88525fae096886fb7a7b19247a7c5176/pymc/distributions/shape_utils.py?plain=1#L88-L98

My main concern is not within pymc package directly but in the downstream usage where using dict[str, Any] is probably the most common way to type coords. So exposing would have some typing benefit.

williambdean avatar Nov 21 '25 16:11 williambdean