Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Mark Bourne via Python-list
Thomas Nyberg wrote: Hi, Yeah so flask does support async (when installed with `pip3 install flask[async]), but you are making a good point that flask in this case is a distraction. Here's an example using just the standard library that exhibits the same issue: `app.py` ``` import asyncio

Re: the name ``wheel''

2024-03-22 Thread Mats Wichmann via Python-list
On 3/22/24 11:45, Barry via Python-list wrote:  On 22 Mar 2024, at 15:25, Gilmeh Serda via Python-list wrote: Many if not most Linux distributions do not include pip by default. Really? It came with Manjaro. Debian and Ubuntu require you to install pip as a separate package. Also puts

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Dieter Maurer via Python-list
dieter.mau...@online.de wrote at 2024-3-22 18:28 +0100: >Thomas Nyberg wrote at 2024-3-22 11:08 +0100: >> ... `future` use across thread boundaries ... >> Here's an example using just the standard library that >> exhibits the same issue: > ... >For use across thread boundaries, you likely will use

RE: Popping key causes dict derived from object to revert to object

2024-03-22 Thread AVI GROSS via Python-list
Loris wrote: "Yes, I was mistakenly thinking that the popping the element would leave me with the dict minus the popped key-value pair. Seem like there is no such function." Others have tried to explain and pointed out you can del and then use the changed dict. But consider the odd concept of

Re: the name ``wheel''

2024-03-22 Thread Barry via Python-list
 > On 22 Mar 2024, at 15:25, Gilmeh Serda via Python-list > wrote: > >> Many if not most Linux distributions do not include pip by default. > > Really? It came with Manjaro. Debian and Ubuntu require you to install pip as a separate package. Also puts venv in its own package. Fedora leaves

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Dieter Maurer via Python-list
Thomas Nyberg wrote at 2024-3-22 11:08 +0100: > ... `future` use across thread boundaries ... > Here's an example using just the standard library that > exhibits the same issue: I think all `asyncio` objects (futures, tasks, ...) are meant to be used in a single thread. If you use them across

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Grant Edwards via Python-list
On 2024-03-22, Loris Bennett via Python-list wrote: > Yes, I was mistakenly thinking that the popping the element would > leave me with the dict minus the popped key-value pair. It does. > Seem like there is no such function. Yes, there is. You can do that with either pop or del: >>> d =

Re: the name ``wheel''

2024-03-22 Thread Thomas Schweikle via Python-list
Am Do., 21.März.2024 um 18:58:26 schrieb Johanne Fairchild via Python-list: r...@zedat.fu-berlin.de (Stefan Ram) writes: Johanne Fairchild wrote or quoted: Why is a whl-package called a ``wheel''? Is it just a pronunciation for the extension WHL or is it really a name? PyPi in its

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Loris Bennett via Python-list
Mark Bourne writes: > Loris Bennett wrote: >> Hi, >> I am using SQLAlchemy to extract some rows from a table of 'events'. >> From the call to the DB I get a list of objects of the type >>sqlalchemy.orm.state.InstanceState >> I would like to print these rows to the terminal using the >>

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Mark Bourne via Python-list
Loris Bennett wrote: Hi, I am using SQLAlchemy to extract some rows from a table of 'events'. From the call to the DB I get a list of objects of the type sqlalchemy.orm.state.InstanceState I would like to print these rows to the terminal using the 'tabulate' package, the documentation for

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Frank Millman via Python-list
On 2024-03-22 1:23 PM, Frank Millman via Python-list wrote: On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote: I am no expert. However, I do have something similar in my app, and it works. I do not use 'await future', I use 'asyncio.wait_for(future)'. I tested it and it did not

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Frank Millman via Python-list
On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote: I am no expert. However, I do have something similar in my app, and it works. I do not use 'await future', I use 'asyncio.wait_for(future)'. I tested it and it did not work. I am not sure, but I think the problem is that you

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Lars Liedtke via Python-list
Sorry, must have missed that :-/ Lars Liedtke Lead Developer [Tel.] +49 721 98993- [Fax] +49 721 98993- [E-Mail]l...@solute.de solute GmbH Zeppelinstraße 15 76185 Karlsruhe Germany [Marken] Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Frank Millman via Python-list
On 2024-03-20 10:22 AM, Thomas Nyberg via Python-list wrote: Hello, I have a simple (and not working) example of what I'm trying to do. This is a simplified version of what I'm trying to achieve (obviously the background workers and finalizer functions will do more later): `app.py` ```

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Thomas Nyberg via Python-list
Hi, Yeah so flask does support async (when installed with `pip3 install flask[async]), but you are making a good point that flask in this case is a distraction. Here's an example using just the standard library that exhibits the same issue: `app.py` ``` import asyncio import threading

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Chris Angelico via Python-list
On Fri, 22 Mar 2024 at 18:35, Lars Liedtke via Python-list wrote: > > Hey, > > As far as I know (might be old news) flask does not support asyncio. > > You would have to use a different framework, like e.g. FastAPI or similar. > Maybe someone has already written "flask with asyncio" but I don't

Re: Using a background thread with asyncio/futures with flask

2024-03-22 Thread Lars Liedtke via Python-list
Hey, As far as I know (might be old news) flask does not support asyncio. You would have to use a different framework, like e.g. FastAPI or similar. Maybe someone has already written "flask with asyncio" but I don't know about that. Cheers Lars Lars Liedtke Lead Developer [Tel.] +49 721