-
Notifications
You must be signed in to change notification settings - Fork 37
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 pformat to config object #33
Conversation
Thanks, I'm in favour of this. Something similar was requested in #13. Please:
|
Oh and there's also https://github.com/panyanyany/beeprint. Why are they all equally good looking lol |
Thanks for the feedback. The The precedence I expect is:
I'm a bit hesitant to this check for external libraries during runtime but it's your shot of course. Personally I will just be using my own pretty printer for now. On the failing test case: I'm not sure what happens on 3.4, but all of the versions get really confused after the |
New commit pushed now. I am not sure how to test if the 3rd party printing libraries are there with the tox setup. Ideally both with and without 3rd party printing libraries should be tested. |
I wrote:
I designed the test a bit differently, now this distractor is not present. |
Ok, python 3.4 is still confused. Is this to be expected? |
Use |
That really shouldn't happen, I will try finding out why later on. |
Do you have some way to install all the python versions for tox? I'm installing |
If you have difficulties, I'll handle the tests. |
Hmm yes please do, I'm struggling getting a 3.4 working. |
Install all the libraries for tests. Test that it uses |
Oh, beeprint is not just like pprint, forget that. |
I'm catching all exceptions rather than just ImportError because that's been an issue for me before: alexmojaki/birdseye#82 |
Fixed in #34. This was a very weird and interesting problem, see cool-RR/PySnooper#214 for the explanation. Thanks for your contribution which picked this up. |
Added a few lines of documentation and tests for the 3rd party libraries. Turns out you can simply do
Nice! |
I only ran tests for 2.7 and 3.9 since that's the versions I have around 😬 |
If you want a custom column, please open an issue to tell me what you're interested in! In the meantime, you can pass a list, where the elements are either strings or callables. The callables should take one argument, which will be an `Event` object. It has attributes `frame`, `event`, and `arg`, as specified in [`sys.settrace()`](https://docs.python.org/3/library/sys.html#sys.settrace), and other attributes which may change. | ||
|
||
If you want a custom column, please open an issue to tell me what you're interested in! In the meantime, you can pass a list, where the elements are either strings or callables. The callables should take one argument, which will be an `Event` object. It has attributes `frame`, `event`, and `arg`, as specified in [`sys.settrace()`](https://docs.python.org/3/library/sys.html#sys.settrace), and other attributes which may change. | ||
- `pformat`: set the pretty formatting function `pp` uses. Default is to use the first of `prettyprinter.pformat`, `pprintpp.pformat` and `pprint.pformat` that can be imported. |
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.
Please also mention the pformat argument here and under Output configuration.
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.
It is mentioned there (?) I pushed a new commit which adds it to the README's Output configuration section.
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.
lol my brain only saw mention of the libraries and not the argument.
Had to take a detour to fix birdseye which was broken by a new release of sqlalchemy... |
Ah, I think I meant to say that pformat needs to be mentioned here: https://github.com/alexmojaki/snoop#pp---awesome-print-debugging . But now that I think of it, there's no mention of configuration there, so it's fine. Anyway, this is released under 0.3.0 Thank you! |
Thanks Alex! |
I sometimes find
pprint.pformat
suboptimal so it would be nice if I could drop-in replace it for snoop. This PR addspp_pformat
to the config object (and thesnoop.install
method) to override it with some other function.It is also useful if you want to configure
pprint.pformat
, for example passingsort_keys=False
.