-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
LaTeX and pretty str representations for v4, continued #4849
Conversation
@@ -668,6 +669,13 @@ def __init__( | |||
self.deterministics = treelist() | |||
self.potentials = treelist() | |||
|
|||
from pymc3.printing import str_for_model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not move this to the global level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the circular import (printing
depends on model
and vice versa). I don't like the look of this either, but it seems to be the recommended way to avoid circular imports.
This looks good to me code-wise. Not sure what's going on with CI. |
Hmm it appears that my use of |
I'm on vacation and won't be able to take a look before Wednesday, so don't wait for my review. |
This now depends on #4858. Once that's merged I'll rebase this one and CI should hopefully be all green. |
fea949e
to
6352da0
Compare
Codecov Report
@@ Coverage Diff @@
## main #4849 +/- ##
==========================================
+ Coverage 72.11% 72.73% +0.61%
==========================================
Files 85 86 +1
Lines 13739 13748 +9
==========================================
+ Hits 9908 9999 +91
+ Misses 3831 3749 -82
|
This achieves largely the same as discussed in #4692, though now without either type patching or overriding
__repr__
or__str__
in Aesara. I've also updated the relevant tests.Quoting the previous PR:
The code is structured somewhat differently from the previous PR, and in terms of functionality the main difference is that this PR will only provide pretty printing in IPython shells (and Jupyter), by registering custom pretty printing handlers on import of
pymc3.printing
. The previous PR attempted to be universal (also in plain python shells) by overriding__repr__
, leading to potentially hairy situations.