-
-
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
Add str/repr formatting options and change defaults accordingly #4260
Conversation
+ new options "latex_with_params" and "plain_with_params" replace the current default behavior of including input parameters (going back to default behaviour of the 3.9.3 release) + __latex__ and _repr_latex default to "latex_with_params" + __str__ and _str_repr default to "plain" + new formatting kwarg for model_to_graphviz enables switching between "plain" (default) and "plain_with_params"
+ latex formatting should be detected by `if "latex" in formatting` to catch both format options + all latex reprs except for an entire model default to "latex_with_params" + tests now cover cases with and without params
+ test_issue_4186 was merged into TestStrAndLatexRepr and now all 4 formatting options are covered.
Thanks @michaelosthege! I'm wondering what should be the default option. Right now the long |
For simple RVs yes, but in most real-world models, these representations will be huge expressions... And they also show up in tracebacks that are already hard to read. If we adopt a global |
Codecov Report
@@ Coverage Diff @@
## master #4260 +/- ##
==========================================
- Coverage 88.15% 88.13% -0.03%
==========================================
Files 87 87
Lines 14243 14257 +14
==========================================
+ Hits 12556 12565 +9
- Misses 1687 1692 +5
|
"""Magic method name for IPython to use for LaTeX formatting.""" | ||
return self._str_repr(formatting="latex", **kwargs) | ||
return self._str_repr(formatting=formatting, **kwargs) |
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.
I'm surprised that codecov is complaining that this line is not covered by tests, as far as I can tell it should be?
Looks good to me! See my one review comment about a line somehow missing tests (or malfunctioning codecov?). Also we're still waiting on Travis before we can merge... I might file a later PR for your review @michaelosthege which improves (drastically shortens) the display of parameter values, such that maybe that can be the default (again)? For now I agree better to stick with this version. |
Tests are now run via GitHubActions, Travis can be ignored I'll just have a quick look regarding the non-covered line EDIT: just noticed there's a test failure on master, I'll take a look at that, no need to wait for me on this one |
Thanks @michaelosthege and @Spaak! |
__latex__
and_repr_latex
default to "latex_with_params"__str__
and_str_repr
default to "plain"__latex__
repr of a model defaults to "latex" (without params)model_to_graphviz
enables switching between "plain" (default) and "plain_with_params"Depending on what your PR does, here are a few things you might want to address in the description:
what are the (breaking) changes that this PR makes?- Noneconsider adding/updating relevant example notebooksright before it's ready to merge, mention the PR in the RELEASE-NOTES.md