Code Monkey home page Code Monkey logo

Comments (5)

willmcgugan avatar willmcgugan commented on May 21, 2024 2

I've added experimental support to v0.8.6, now on pypi.

If you do from rich.jupyter import print you can print any Rich renderable to the notebook.

from rich.

willmcgugan avatar willmcgugan commented on May 21, 2024 1

I did some experimentation, and I was correct about Jupyter wrapping stdout. isatty returns False, so Rich disables ANSI styles -- even though Jupyter is capable of rendering them. If I force Rich to enable styles they do work.

Another issue is detecting the size of the terminal. When running in Jupyter, the size is detected as the size of the terminal running the server, not the output area on the screen. This leads to things wrapping incorrectly and breaking tables etc.

I'm sure some form of integration is possible. Still thinking of how it should work. Let me know if you have any ideas on that front.

from rich.

jjmachan avatar jjmachan commented on May 21, 2024

small correction, jupyter notebooks does support ASCII colors but the default settings of Rich console does not detect its and strips away the colors. Any suggetions to fix it?

from rich.

willmcgugan avatar willmcgugan commented on May 21, 2024

I don’t see why not. If it’s just a matter of adding that html_repr method, it’s not a lot of work.

Rich will disable colours if it doesn’t detect a terminal. It calls ‘istty’ on the file object. I’m guessing that Jupyter is wrapping stdout and breaking that somehow. I’ll look in to that, I’m sure there is a simple workaround.

from rich.

jjmachan avatar jjmachan commented on May 21, 2024

Awesome!
Works really well even though the width is fixed rendering is proper
Thanks for being super responsive 😄

from rich.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.