what happens if the server is created with multiple processes (for multiple cores) with uvicorn main:app --workers 4. The first 4 clients are given a new process? or it can be either a process or another thread if a thread is in a non-blocking task? and what happens when there are more than 4 clients at the same time in this case? the new clients are assigned to threads randomly across the 4 processes?
@PriyankRupareliya5 күн бұрын
This is very valuable content. New job, starting to work on FastAPI. The whole python paradigm is new for me. This video helped clear one of the most critical concept for me. Thanks brother.
@adityahpatel15 күн бұрын
2 and 3 look the same. hello of each is printed first then bye from each. how is 2 and 3 different? its not explained crystal clearly
@RaadClub17 күн бұрын
Thanks man.
@ArulMuruganAS23 күн бұрын
its working as explained in unix but for some reason its a different behavior in windows
@harikrishnanb727323 күн бұрын
is there a english version?
@startup_cult29 күн бұрын
this is such an underrated video
@ashwinabrahamjacob525Ай бұрын
great video
@diwakardayalanАй бұрын
Excellent…can it create mock test involving AWS services?
@rainbowrunner1136Ай бұрын
Hello, great video. I am super new to python. And started using very recently for backend where its being used along with FastAPI. Can you please tell me what are some concepts/ topics which I should be aware for developing efficient code. For eg from this video, I learnt that which function runs concurrently and which doesn't. I had no idea tbh about this before. If you could spare few minutes and share some stuff which I should know it would be great.
@apefuАй бұрын
I have so many questions, I am so sorry. Should you pass app to the AsyncClient() as well for the ASGI server? Also, how would the last example affect APIRouters defined in separate files? How would they reach app.client? They could have their separate lifespan function but wouldn't it be prefered to use the same object? Also, I don't know, but wouldn't it be better to use app.state.client? Oh, and what about POST requests, would you still use the Request object to reach the client? It works, but it gets messy code wise.
@rohit1kumar2 ай бұрын
got any benchmarks?
@Gameplay-ps9ub2 ай бұрын
Well issue with this kind of libraries imho is, that real life code is not a single module separated from everything else. It's much bigger than that and has a ton of dependencies and/or setup and tear down required. Some tests require quite a lot of fixtures and some of those fixtures are configurable as well. Conclusion is...I'd have to change manually great majority of that auto generated tests to make them any good, so I might as well right them on my own from scratch. And it doesn't support python 3.11+, so it's a big issue.
@НиколайРюмин-й6и2 ай бұрын
oh, sorry, that was a hook for further story
@НиколайРюмин-й6и2 ай бұрын
Maybe better practice to read chunks from file is async for?
@MakeDataUseful2 ай бұрын
Great video, thanks for sharing
@Shane19943223 ай бұрын
Clearly explained!! Thank you
@badrakhariunchimeg10313 ай бұрын
Well fastapi ( fun get ( ))
@PyPeak3 ай бұрын
Beautifully explained!
@mattstroker37423 ай бұрын
Nice!
@vikranttyagiRN3 ай бұрын
Nice explanation. Concise and to the point.
@oktay97843 ай бұрын
this is not about FastApi, its about sync functions and async functions so just dont use sync functions in async functions if sync one is takes a lot of time.
@MakeDataUseful2 ай бұрын
This is a fastAPI video
@805bluebell2 ай бұрын
It's actually both. End of argument
@sticksen3 ай бұрын
My question would be how FastAPI then manages workload when it´s handed over to the worker thread. Because I can only see one worker thread running, at the same time it handles 40 'workloads' concurrently.
@sany2k83 ай бұрын
Great explanation, you should create more videos bro...
@arjunc58963 ай бұрын
def endpoint3() is not running parallely for me as supposed to what u said in the video. Instead it is sunning one at a time. Do u know why?
@codecollider3 ай бұрын
I believe you are testing APIs in the browser. Sometimes, browsers like Chrome have limitations on making parallel requests to the same URL. In the video, if you look closely, I am using two different browsers to hit the same API in parallel. You can try the same approach.
@arjunc58963 ай бұрын
@@codecollider Yes you are right. I tried from different browsers and it worked. Strange though. Thanks
@nitishvirtual47453 ай бұрын
Great video. Short and to the point. Subscribed.
@ChrisHalden0073 ай бұрын
Great video. Thanks
@ahmedelnakeeb58533 ай бұрын
this should boom i love ur channel
@lwangacaleb27294 ай бұрын
I need some help, I want to create a fast api endpoint that calls a synchronous function that has a lot of blocking I/0 operations. But I want the endpoint function to run asynchronously so it can accept many requests at the same time. How should I do this, is there an alternative approach?
@Praise-rs4mc3 ай бұрын
The only way to achieve that is to use multi-threading which I advice against.... instead, make the function asynchronous and try to find the non-blocking function for what you want to do...
@Praise-rs4mc3 ай бұрын
Better still, use the run_in_threadpool function from fastapi to run the process in a different thread so that you don't block the event...better than implementing multi threading on your own.
@lwangacaleb27293 ай бұрын
@@Praise-rs4mc thanks alot, I will give it a try.
@shantanudas63194 ай бұрын
Crisp and clear ❤
@ChrisHalden0074 ай бұрын
Great video. Thanks
@amodsahabandu4 ай бұрын
Thanks. ❤
@thanosaur67414 ай бұрын
great video
@robertavetisyan82824 ай бұрын
boooozi txeq
@richardboreiko4 ай бұрын
Why not just return condition?
@codecollider4 ай бұрын
Using `return condition` directly is more efficient when you only need to return the boolean value itself. However, the purpose of my comparison was to explore different styles of conditional statements and their performance, especially in scenarios where the if-else structure is necessary for more complex logic.
@suen-tech4 ай бұрын
Thnx
@user-sh1fv9mm2v4 ай бұрын
I always upload with just an post.
@SAsquirtle4 ай бұрын
very nice video, thanks!
@udaym42044 ай бұрын
can you make fastapi how run under the hood and how @app.exception_handler work Thanks awesome contentent
@ishaquenizamani98004 ай бұрын
Thanks for clearing this concept.
@boringhuman94274 ай бұрын
As per LEGB rule , it is considered as enclosed variable - neither local or global but behaves as local and global within a function more specifically under decorators
@MakeDataUseful2 ай бұрын
Local, Enclosing, Global, and Built-in scopes for those playing along at home
@user-sh1fv9mm2v4 ай бұрын
Your videos are the best. No bs, just facts.
@MathClubfor67894 ай бұрын
Great knowledgable video
@temirlllan4 ай бұрын
thx bro! so useful material, keep going
@myselfriz4 ай бұрын
very well explanation.
@cyyan11394 ай бұрын
thank you!
@pritamsarkar33714 ай бұрын
dont we have to enable the 68 no line? "app = Fastapi(lifespan=lifespan)" ?
@codecollider4 ай бұрын
Yes you have to uncomment that line if you are using lifespan, forget to tell in the video.
@seva93754 ай бұрын
Hello I am not able to run Pynguin. I tryed your approach and got this error: (base) seva@air-von-seva Pynguin_input % pynguin --project-path . --module-name test_example_2 --output-path . Traceback (most recent call last): File "/Users/seva/anaconda3/bin/pynguin", line 5, in <module> from pynguin.cli import main File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/__init__.py", line 9, in <module> import pynguin.generator as gen File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/generator.py", line 31, in <module> import pynguin.analyses.seeding as seeding # pylint: disable=consider-using-from-import ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/analyses/seeding.py", line 25, in <module> import pynguin.ga.testcasechromosome as tcc File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/ga/testcasechromosome.py", line 13, in <module> import pynguin.ga.chromosome as chrom File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/ga/chromosome.py", line 13, in <module> import pynguin.ga.computations as ff File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/ga/computations.py", line 17, in <module> from pynguin.testcase.execution import ExecutionTrace File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/testcase/execution.py", line 425, in <module> class ExecutionTracer: File "/Users/seva/anaconda3/lib/python3.11/site-packages/pynguin/testcase/execution.py", line 460, in ExecutionTracer Compare.IN: lambda val1, val2: ( ^^^^^^^^^^ File "/Users/seva/anaconda3/lib/python3.11/enum.py", line 784, in __getattr__ raise AttributeError(name) from None AttributeError: IN