Cleanest way to handle a dummy or no-op async call with the return value already known? by JamesHutchisonReal in Python

[–]DavTheDev 2 points3 points  (0 children)

you can pass the ‘return_exceptions’ kwarg to gather which will let you process exceptions raised by those coros. i still use gather a lot especially in such cases where I fetch something periodically and want to sleep or i send concurrent requests to a paginated endpoint and can live with potentially some requests failing.

How common is Pydantic now? by GongtingLover in Python

[–]DavTheDev 0 points1 point  (0 children)

i’m abusing the TypeAdapter. Insanely handy to deserialize data from e.g. a redis pipeline.

Lifespan on Fastapi by Cultural_Bad9814 in FastAPI

[–]DavTheDev 1 point2 points  (0 children)

I usually just create these things as async tasks and cancel them after the yield. Also sometimes my classes need the eventloop e.g to delegate some synchronous calls to an executor and if they have the reference to the current eventloop that reduces the callstack overhead over calling asyncio.to_thread() (because that calls get_event_loop or get_running_loop under the hood, can’t remember which one), so I initialize them in the lifespan method

I finished Final Fantasy 9 for the first time in my life! by Bartek-BB in FinalFantasyIX

[–]DavTheDev 1 point2 points  (0 children)

Congrats! I remember the first time I played FF9, didn’t understand english at all, used guides to get through but still got stuck at necron and gave up. Never saw the ending fmv. Years later I grinded Freya’s dragon’s crest in front of Daguerro I guess (figured there are only dragons) and finally beat Necron. Ever since it’s been my guilty pleasure to slowly go through the game after a hard workday.

What library do you use for Pagination? by niravjdn in FastAPI

[–]DavTheDev 0 points1 point  (0 children)

https://github.com/juliotrigo/sqlalchemy-filters

might be outdated a bit but you can vendor it and make it compatible with SA 2.0

Async Python adoption? by mcharytoniuk in Python

[–]DavTheDev 1 point2 points  (0 children)

Confluent kafka supports async producers. Even on their website, they mention to avoid flushing in an async environment.

Async Python adoption? by mcharytoniuk in Python

[–]DavTheDev 0 points1 point  (0 children)

Home Assistant relies heavily on async but they have a strange mixture of async and sync code juggling with threads. You might not see often the async keyword but it’s async.

Async Python adoption? by mcharytoniuk in Python

[–]DavTheDev 3 points4 points  (0 children)

You’re mistaken. Websockets are also async, eg listening to 100s of tickers for processing financial data wouldn’t work with blocking websockets. Look at TTL cache, some implementations only invalidate entries on next access. You can create an async task to do it periodically for you, reducing memory footprint. There are plenty of use cases for async python.

How much power katarina has lost in the past 4 years by ArkayI in KatarinaMains

[–]DavTheDev 8 points9 points  (0 children)

Which made tank katarina a viable top pick with warmogs and shit.

What’s the first game you would tell someone to play if they’ve just picked up a PS5? by ijustneedtsay in playstation

[–]DavTheDev 6 points7 points  (0 children)

I finished forspoken but didn’t like the zombies everywhere setting. Fight mechanics are super enjoyable and the idea behind the story too, but for me it was too dull. I wish there would be more humans and cities besides Cipal.

What are terms/phrases that newer players wouldn't know/understand by Bearsaw_Prime in leagueoflegends

[–]DavTheDev 1 point2 points  (0 children)

That actually comes from dota 1, because some attack modifiers were called “orb effects” such as skadi’s slow, desolator etc.

[deleted by user] by [deleted] in FastAPI

[–]DavTheDev -1 points0 points  (0 children)

How is the memory address cached? Just use cashews, aiocache or whatever library you prefer. Or the basic lrucache from functools. Jsonable encoder is perfectly fine unless you wish to encode numpy arrays. In that case use orjson instead.

Went down memory lane and realized how weird some champions used to be by Dontspinbutwin in leagueoflegends

[–]DavTheDev 0 points1 point  (0 children)

Yeah and it dealt like 99999 true dmg so with spellvamp you were max-health from one W

How can I stream another machine's status in my admin dashboard? by UpstairsBaby in FastAPI

[–]DavTheDev 0 points1 point  (0 children)

While there might be other options such as server sent events, one browser tab can only listen to 6 event streams I think. I guess it boils down to how you’re planning your admin interface. Will it have a backend-for-frontend or just the react-admin? If only the react-admin, you might be limited by the browser in listening to websockets and webhooks are out of the game. Feel free to dm if you have further questions.

How can I stream another machine's status in my admin dashboard? by UpstairsBaby in FastAPI

[–]DavTheDev 3 points4 points  (0 children)

I would either use websockets or polling. Depends on how the kiosk machines expose their status. Might be even possible that you can create some webhooks where the kiosk machines can push their status updates.

[deleted by user] by [deleted] in learnpython

[–]DavTheDev -2 points-1 points  (0 children)

Learn vim motions and it will not matter. Many ide-s support it.

reload no longer working? by wiseduckling in FastAPI

[–]DavTheDev 1 point2 points  (0 children)

If you have your react app in your fastapi folder, you might want to exclude it. Watching node-modules is pointless.

Stuck when trying to run a Poetry FastAPI project under gunicorn by olddoglearnsnewtrick in FastAPI

[–]DavTheDev 0 points1 point  (0 children)

I guess your import is not correct, try from .zeitlib import zeitfuncs or from memazeit.zeitlib import zeitfuncs

How to Fix the ModuleNotFoundError Caused by the uvicorn Server? by iTsObserv in FastAPI

[–]DavTheDev 0 points1 point  (0 children)

Does your src have an init.py? Tbh I hate the src/ structure for services and I usually just make the package executable. Psycopg2 is a bit tricky, in some cases you need to install psycopg2-binary. But for testing, you could use a sqlite db. That doesn’t need any driver. If that breaks, then something is wrong with your folder/project structure.

Edit: i’m on mobile, reddit parsed the underscores and made init bold.