by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 10:39
    dependabot-preview[bot] synchronize #1680
  • 10:39

    dependabot-preview[bot] on pip

    Bump ipython from 7.16.1 to 7.1… (compare)

  • 10:39
    dependabot-preview[bot] edited #1680
  • 10:37
    dependabot-preview[bot] edited #1680
  • 10:37

    dependabot-preview[bot] on pip

    (compare)

  • 10:37

    dependabot-preview[bot] on master

    Bump prompt-toolkit from 3.0.5 … Merge pull request #1682 from p… (compare)

  • 10:37
    dependabot-preview[bot] closed #1682
  • 10:28
    dependabot-preview[bot] labeled #1682
  • 10:28
    dependabot-preview[bot] opened #1682
  • 10:28

    dependabot-preview[bot] on pip

    Bump prompt-toolkit from 3.0.5 … (compare)

  • Aug 10 07:32

    dependabot-preview[bot] on pip

    (compare)

  • Aug 10 07:32

    dependabot-preview[bot] on master

    Bump sphinx from 3.1.1 to 3.2.0… Merge pull request #1681 from p… (compare)

  • Aug 10 07:32
    dependabot-preview[bot] closed #1681
  • Aug 10 07:22

    dependabot-preview[bot] on pip

    (compare)

  • Aug 10 07:22
    dependabot-preview[bot] closed #1663
  • Aug 10 07:22
    dependabot-preview[bot] labeled #1681
  • Aug 10 07:22
    dependabot-preview[bot] opened #1681
  • Aug 10 07:22

    dependabot-preview[bot] on pip

    Bump sphinx from 3.1.1 to 3.2.0… (compare)

  • Aug 10 06:15

    dependabot-preview[bot] on pip

    (compare)

  • Aug 10 06:15

    dependabot-preview[bot] on master

    Bump sphinx from 3.1.2 to 3.2.0… Merge pull request #224 from py… (compare)

Royce Mitchell
@remdragon
@njsmith it may not be shorter, but I think it definitely is less invasive on win32 application structure: https://gist.github.com/remdragon/6dd5c70455ff6f499336f4f192dec36b
Alex Grönholm
@agronholm
@pquentin I've already split my changes into meaningful units
I don't see how splitting those further into several commits makes it easier to review
at least I just look at the changed files as a whole
Alex Grönholm
@agronholm
I'm wondering why trio.socket.SocketType is a dummy class
it's a PITA when trying to make it work with static typing
richardsheridan
@richardsheridan
@remdragon event_loop never awaits anything from trio, won't it will block the trio guest event loop?
Mattia
@nocturn9x
@njsmith I have a question. In trio, both tasks that are spawned trough a nursery and awaited coroutines are cancellable. How do you achieve that? I guess that tasks that are spawned have a specific flag (like spawned=True) but how do you get coroutines that are called with the await syntax into task objects?
Royce Mitchell
@remdragon
@richardsheridan the way I understand guest mode it doesn't need to. trio will call run_sync_soon_threadsafe() with a callable when it needs attention. and the callable provided to that function doesn't need to be awaited. From what I can tell this complies with trio's guest mode, but I haven't tried it yet
I think trio probably does some task switching magic when it gets those callbacks
Royce Mitchell
@remdragon
I just tweaked it to remove the GetMessage(). After thinking about it, I don't think it's necessary, should make the whole thing use fewer cpu cycles.
Royce Mitchell
@remdragon
We could also make a simpler version that just returns a MSG object once one has been received. That way the function would act like a drop-in replacement for GetMessage() itself and app developers can still use their own win32 event loop logic. I think I could also emulate PeekMessage... hmm..
András Mózes
@mozesa
Hello, could you help me. Could be any drawback of using AsyncExitStack with Nursery?
I mean could something go wrong because of using AsyncExitStack with Nursery. I don't know how fragile nurseries are. :smile:
Matthias Urlichs
@smurfix
@mozesa I'm using that combination in a couple places. No problems so far.
András Mózes
@mozesa
@smurfix Good to hear that. Thanks!
Joshua Oreman
@oremanj
@mozesa It’s fine as long as you use the AsyncExitStack in a way that matches something you could theoretically do with a series of async with statements. But AsyncExitStack combined with async with statements allows you to express other patterns too, and some of those won’t work, like “enter nursery 1, enter nursery 2, leave nursery 1, leave nursery 2” in that order.
András Mózes
@mozesa
@oremanj :thumbsup: Great thanks
Joshua Oreman
@oremanj
@nocturn9x await doesn’t create a new task — it’s just a function call. It is not actually even possible for Trio to do something on every await, just like you can’t make Python do something on every function call. One task is associated with the entire async callstack, starting with the thing that was spawned using nursery.start_soon or trio.run and ending with the Trio primitive that it’s currently waiting on. (At the lowest level, almost all Trio programs use only two such primitives: wait_task_rescheduled and cancel_shielded_checkpoint. There’s one more used only in rather obscure cases. See trio/_core/_traps.py.)
Kyle Altendorf
@altendky
last time i looked i didn't find the origin of the name trio, but i thought at some point i saw it... where am i supposed to be looking?
Joshua Oreman
@oremanj
@altendky I think the practical reason is “it was short, available, pronounceable, and ended in -io” but there are a number of alternative explanations
one: it arranges your tasks in a tree-oh
two: it’s based on three fundamental concepts: async functions, cancel scopes, and nurseries
IIRC in the very earliest stages of development (pre 0.1.0) it was called “oratorio”
Nathaniel J. Smith
@njsmith
also I liked the image of multi-person music as an example of concurrency
but yeah it's just a name, there's no deep meaning
(iirc the name actually predates the discovery of nurseries, so the "alternative explanations" really are just happy accidents)
Kyle Altendorf
@altendky
thanks both. so the X here is that qtrio is still 'just a name' to me rather than something i particularly like :] and i'm indulging since i think i'm close to a first release. triq was offered up by one of the existing qt/trio projects. quattro is available. quartet is namesquatted from 2017 so kinda available, sorta. it seems like there's value to both 'relating' to the name trio and also being different by more than just an extra q. and from two: above i could see 'widgets' being a fourth thing. i'm stuck between 'meh' and 'stop bikeshedding'.
Royce Mitchell
@remdragon
qtrio is kinda cool because it's a portmanteau, if you're into that sorta thing
Quentin Pradet
@pquentin
+1 for qtrio, obvious, and contains both Qt and Trio as mentioned by @remdragon
goodboy
@goodboy
yeah i called my internal entry point qtrio originally
now it's qtractor lel
Kyle Altendorf
@altendky
welp, there's the first release https://qtrio.readthedocs.io/ of course thanks to the trio team both for the help getting this far and for providing guest mode etc to allow this to happen now.
András Mózes
@mozesa
@altendky Awesome :fireworks:
Royce Mitchell
@remdragon
@agronholm I feel like my smtp protocol is in pretty good shape now, wouldn't mind your feedback if you don't mind looking at it.
matrixbot
@matrixbot
decentral1se nice work on qtrio!
decentral1se \o/
Mattia
@nocturn9x
@oremanj thanks! I don't even know why I was thinking about that so much, lol
Still no interested contributors? haha
András Mózes
@mozesa

Hello, I am facing a problem hope you will help me out. :)

I use a device which has its own event loop which runs only during YAPI.Sleep().
I don't know whether I need the brand-new guest mode or not, but what I would like is to be able to check whether there is a live cancellation in the context from where function was called previously.

And if there is a live cancellation I simply break the loop running in thread. I know there is a cancellable=True flag but I don't want to let threads run silently.

Thanks for your help in advance.

    async def async_main():
        register_usb_hub()

        def trampoline():
            errmsg = YRefParam()
            while True:
                YAPI.Sleep(1_000, errmsg=errmsg)
                print(trio.from_thread.run_sync(trio.current_effective_deadline))

        with trio.move_on_after(5.0):
            await trio.to_thread.run_sync(trampoline, cancellable=False)

    trio.run(async_main)
richardsheridan
@richardsheridan
@mozesa I got this recipe for cancelling threads from someone in this channel a while ago (maybe @oremanj ?) and i've been pretty happy with it.
you must call it frequently though, so instead of YAPI.Sleep(1_000) use `YAPI.Sleep(100) or whatever you can afford
NoskLo
@nosklo_gitlab
if your YAPI thing has a threadsafe way to schedule a function to be called soon, you can use guest mode instead
András Mózes
@mozesa
@richardsheridan , @nosklo_gitlab Thanks both of you for the ideas.
Kyle Altendorf
@altendky
maybe someone has an opinion about how trio.run and similar take *args and forward them rather than taking an args sequence and a kwargs map? altendky/qtrio#92
Nathaniel J. Smith
@njsmith
@altendky here are 58 comments worth of opinions :-) python-trio/trio#470
Kyle Altendorf
@altendky
:]
Royce Mitchell
@remdragon
There doesn't appear to be a zero-copy method for receiving from a trio.abc.ReceiveStream. Something like this following:
buffer = bytearray ( 256 )
watermark = 42
view = memoryview ( buffer )[watermark:]
room = len ( buffer ) - bufsize

stream = trio.abc.ReceiveStream ( ... )
received_bytes = stream.receive_into ( view, limit = room )
if not received_bytes:
    raise EOFError()
watermark += received_bytes
is trio open to a PR to implement this?