Python’s performance bottlenecks were criticized for years,
but thanks to the hard work of developers,
Asyncio was introduced in Python 3.4 to improve performance in specific scenarios.
By Python 3.13, the Free-threaded design (PEP-703) emerged,
allowing the optional disabling of the GIL.
Combined with the pre-existing Multiprocessing and Multithreading,
I have compiled a few records on the principles, differences, and use cases for these three technologies.
This first post will briefly introduce the basic concepts and suitable scenarios for each.
Conversational AI app demonstrating accurate LLM inference with RAG over complex datasets. Tech stack: Serverless FastAPI backend on GCP (provisioned via Terraform), local ONNX embeddings, Firestore vector search, and LangChain orchestration.
A production-grade, asynchronous Python microservice boilerplate engineered to standardize enterprise backend development and eradicate legacy I/O bottlenecks. Enforced strict organizational engineering culture by integrating Docker and mandating a baseline of 95% test coverage.
Functions and Reasons for Using pyenv # pyenv is a tool used to install various versions of Python on a system,
and to conveniently switch between Python versions.
When you need to develop or maintain projects that require different Python versions simultaneously,
you will need to use pyenv to help switch Python versions.
New Python versions usually include syntax updates or new features.
Before the advent of asyncio,
when a Python program had many tasks that needed to be executed concurrently,
and wanted to improve program performance,
the only options were multiprocessing or threading.
After Python 3.4, asyncio became another option.
asyncio can be used to write coroutines,
and execute coroutines concurrently using an event loop,
reducing unnecessary waiting time in the program to improve performance.
Why Pipenv # When maintaining many Python projects,
different projects might use different versions of the same Python libraries.
Not using a virtual environment and installing all Python modules directly on your machine will lead to version conflicts.
In the past, the mechanism of virtualenv + requirements.txt allowed different projects to use different versions of the same package,
and also enabled new developers or production environments to quickly install the packages required by the project.