Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Marcelo Trylesinski
    @Kludex
    unable to print = gc.garbage blocks
    @graingert do u have any idea? /\
    1 reply
    graingert
    @graingert:matrix.org
    [m]
    ooh
    Can you link me to the pprint source?
    graingert
    @graingert:matrix.org
    [m]
    @Kludex: also can you get a traceback from where it hangs?
    You can dig it out of sys._current_frames()
    Marcelo Trylesinski
    @Kludex
    (I'll do it tomorrow night, jfyk - Thanks :pray: )
    graingert
    @graingert:matrix.org
    [m]
    It's very rude to nerd snipe someone this way :/ ;)
    1 reply
    Marcelo Trylesinski
    @Kludex
    import asyncio
    import gc
    from gc import get_objects
    from pprint import pprint
    
    from starlette.applications import Starlette
    from starlette.responses import JSONResponse, Response
    from starlette.routing import Route
    from starlette.requests import Request
    
    gc.set_debug(gc.DEBUG_LEAK)
    
    
    async def homepage(request: Request):
        request.state.test = [x for x in range(999999)]
        return JSONResponse({'hello': 'world'})
    
    
    async def collect(request: Request):
        n = gc.collect()
        pprint(gc.garbage) 
        return JSONResponse({"collected": n})
    
    
    app = Starlette(routes=[Route('/', homepage), Route('/collect', collect)])
    I spent the whole day debugging this
    encode/uvicorn#1564 << I think there's a reference cycle on ServerState <-> HTTP Protocol
    what I'm saying it's unrelated to rich
    it's just to give you context...
    While debugging the uvicorn issue, I tried to use from rich.pretty import pprint but the pprint(gc.garbage) blocks me 4ever
    graingert
    @graingert:matrix.org
    [m]
    Have you fiddled around with pyobjgraph?
    Marcelo Trylesinski
    @Kludex
    pyobjgraph?
    graingert
    @graingert:matrix.org
    [m]
    pip install objgraph
    It's got a thing for finding out what's keeping something alive

    So you'd do something like
    class Canary: pass
    o = Canary()
    request.state.foo = o
    del o
    ...
    objgraph.show_chain(

    objgraph.find_backref_chain(
    
        random.choice(objgraph.by_type('Canary')),
    
        objgraph.is_proper_module),
    
    filename='chain.png')

    ```

    Marcelo Trylesinski
    @Kludex
    image.png
    what do I get from this? :laughing:
    this is just to give me the confirmation, right? because I think I've spotted the reference cycle in the code already
    graingert
    @graingert:matrix.org
    [m]
    Oh right no it shouldn't end up in gc.garbage
    The issue you have is there's a reference cycle that the GC resolves, but you don't want to wait for that?
    Marcelo Trylesinski
    @Kludex
    I don't fully understand the question, and I don't want to give an answer that may mislead us here. So to enrich my knowledge here...
    What does it mean that the "GC resolves, but I don't want to wait for that"? On my situation, if I manually run gc.collect(), my memory goes back to what I'd expect it be - does this say something?
    4 replies
    graingert
    @graingert:matrix.org
    [m]
    But yeah that's what I mean
    graingert
    @graingert:matrix.org
    [m]
    I mean if it's just a cycle then the GC should clean it up for you
    You need to find out what's keeping a reference after the request is finished?
    Steven Bell
    @stevebell117
    @Harmouch101 Just wanted to say thanks for your Definitive Guide, is really helping me get set up creating my own hooked-in Console on my TUI
    1 reply
    Paul m. p. Peny
    @pmp-p
    (sorry to ask again) Is there any sixel support, and if not is it planned by anyone ?
    Pierce Jamieson
    @jamiesonpa
    Does anyone have an example of putting a rich panel inside of another rich panel and getting event handling to work for both? Is that even possible?
    BautistaDalmasso
    @BautistaDalmasso
    hello everyone
    Tyler
    @dolomite_rand_twitter
    Having some trouble wrapping my head around the ScrollView with more than one widget. Is it possible to have a scrollview containing lots of widgets?
    heeplr
    @heeplr
    ahoy!
    sorry if this is an annoying FAQ but is there some rough ETA for a beta-release of the CSS branch? I checked many TUI frameworks and Textual seems to be the best design by far.
    I really love it, except the fact that it's horribly documented and not quite ready, yet :)
    heeplr
    @heeplr
    oh, another question: Is there a good way to debug textual apps with pdb? Currently i'm using "import os;os.system("stty sane");breakpoint()" which fixes terminal output but doesn't remove input handlers, so input characters need to be typed multiple times for them to reach pdb.
    I looked for some "app.reset()" or "app.console.reset()" function to get the terminal in a normal state. Didn't find anything. Where does textual/rich reset the terminal upon exit?
    vegaoqiang
    @vegaoqiang
    how to get window width and height in textual
    Felipe Franciosi
    @franciozzy
    I have a Widget which, on render, returns a Panel with some text inside. How can I make that scrollable?
    1 reply
    Travis B. Hartwell
    @travisbhartwell

    Thinking about separation of concerns, it feels wrong to add __rich_console__ methods to my value objects. In architecting my application, I want to separate things into their components: the value objects that store the domain specific structures; separate serialization/deserialization mechanisms used in saving/loading from storage, and then the presentation layer for how things are presented. Right now I’m using attrs to define my value objects and then cattrs to do the serialization.

    So, does anyone have a pattern that they use that would help with that? It feels like I would have to write a bunch of wrapper classes just for the projections that have the __rich_console__ methods, which doesn’t feel great either.

    exkeros
    @exkeros_twitter
    Hello
    exkeros
    @exkeros_twitter
    I would like to make a grid (like a checker board) but I'm not sure what to use for that. I'm thinking of reactive.table inside a panel ? How can I set a background color and a a border ?
    7 replies
    Felipe Franciosi
    @franciozzy
    It's a shame there's so little engagement in this chat. :( I still haven't managed to get my scrolling thingy working. :(
    exkeros
    @exkeros_twitter
    I have another question, I put two widgets side by side. However, one is size 10 and I would like the second (or first) one to fill the space
    1 reply
    how can I do that ?
    Ronny
    @ronnypfannschmidt:matrix.org
    [m]
    @willmcgugan: what's the current suggested pattern to have the "global" console object of rich not break on stdio redirect, every time I take a look it seems like possible death by papercuts
    ag4ve
    @ag4ve:matrix.org
    [m]
    Is there a recommended terminal/termcap to use with the textual examples? With Blink.app on an iPad into an older Ubuntu box, they’re unusable (they show up, but don’t do anything).
    Or maybe there just needs to be keys bound to navigation events? But I’m ok tapping on the screen to start out, but that’s not working.