Skip to content
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

Don't display() spurious newlines in jupyter #3329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NickCrews
Copy link

@NickCrews NickCrews commented Apr 12, 2024

Fixes #3274

I couldn't think of a way to test the "real" behavior that we are looking for, which is "are random newlines appearing in jupyter's output?", so I had to settle for the proxy of "is ipython's display() ever called?".

I materialized the Iterable[Segment]s into a list, IDK if there are some performance concerns with this (we're about to materialize them all to strings anyway???). If so then I could come up with a less-clean way of checking for "did we get passed nothing")

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

@NickCrews
Copy link
Author

@huzecong does this look like it solves your issue you described in #3274 ?

@willmcgugan friendly ping here, I realize you must have a lot on your plate, but think this should be a fairly easy review. Thank you!

@huzecong
Copy link

huzecong commented Aug 6, 2024

Hey @NickCrews, thanks for putting up this PR! This looks good to me and should solve the issue in #3274.

I materialized the Iterable[Segment]s into a list, IDK if there are some performance concerns with this (we're about to materialize them all to strings anyway???).

This seems reasonable to me too, but I'm no expert in this project and will leave it to the maintainers. One thing I'd like to mention is that our in-house patch only checked if not text, and that was sufficient for us. So if you're concerned about the list conversion, you might want to consider just dropping the check on segments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Captured console output still results in newline being printed in Jupyter
2 participants