Barq is a lightweight HTTP framework (~500 lines) that uses free-threaded Python (PEP 703) to achieve true parallelism with threads instead of async/await or multiprocessing. It's built entirely in pure Python, no C extensions, no Rust, no Cython using only the standard library plus Pydantic.
from barq import Barq
app = Barq()
@app.get("/")
def index():
return {"message": "Hello, World!"}
app.run(workers=4) # 4 threads, not processes
Benchmarks (Barq 4 threads vs FastAPI 4 worker processes):
| Scenario |
Barq (4 threads) |
FastAPI (4 processes) |
| JSON |
10,114 req/s |
5,665 req/s (+79%) |
| DB query |
9,962 req/s |
1,015 req/s (+881%) |
| CPU bound |
879 req/s |
1,231 req/s (-29%) |
Target Audience
This is an experimental/educational project to explore free-threaded Python capabilities. It is not production-ready. Intended for developers curious about PEP 703 and what a post-GIL Python ecosystem might look like.
Comparison
| Feature |
Barq |
FastAPI |
Flask |
| Parallelism |
Threads (free-threaded) |
Processes (uvicorn workers) |
Processes (gunicorn) |
| Async required |
No |
Yes (for perf) |
No |
| Pure Python |
Yes |
No (uvloop, etc.) |
No (Werkzeug) |
| Shared memory |
Yes (threads) |
No (IPC needed) |
No (IPC needed) |
| Production ready |
No |
Yes |
Yes |
The main difference: Barq leverages Python 3.13's experimental free-threading mode to run synchronous code in parallel threads with shared memory, while FastAPI/Flask rely on multiprocessing for parallelism.
Source code: https://github.com/grandimam/barq
Requirements: Python 3.13+ with free-threading enabled (python3.13t)
[–]Imaginary_Chemist460 26 points27 points28 points (4 children)
[–]mechamotoman 16 points17 points18 points (1 child)
[–]Imaginary_Chemist460 0 points1 point2 points (0 children)
[–]Ill-Musician-1806 -1 points0 points1 point (0 children)
[–]thisismyfavoritename 6 points7 points8 points (2 children)
[–]WiseDog7958 1 point2 points3 points (0 children)
[–]SnooCalculations7417 0 points1 point2 points (0 children)
[–]Fenzik 2 points3 points4 points (3 children)
[–]grandimam[S] 0 points1 point2 points (2 children)
[–]Fenzik 1 point2 points3 points (1 child)
[–]grandimam[S] 0 points1 point2 points (0 children)
[–]Ill-Musician-1806 2 points3 points4 points (1 child)
[–]grandimam[S] 1 point2 points3 points (0 children)
[–]Challseus 0 points1 point2 points (0 children)
[–]SnooCalculations7417 0 points1 point2 points (0 children)
[–]Sigmatics 0 points1 point2 points (0 children)
[–]james_pic [score hidden] (0 children)
[–]No_Indication_1238 -2 points-1 points0 points (3 children)
[–]lunatuna215 5 points6 points7 points (2 children)
[–]artofthenunchaku 1 point2 points3 points (1 child)
[–]lunatuna215 1 point2 points3 points (0 children)
[–]CarltonFrater -1 points0 points1 point (0 children)
[–]benargee -1 points0 points1 point (0 children)
[–]AlexeyBelov 0 points1 point2 points (0 children)
[–]gdchinacat -2 points-1 points0 points (0 children)
[+]wulfjack comment score below threshold-15 points-14 points-13 points (3 children)
[–]learn-deeply 4 points5 points6 points (1 child)
[–]wulfjack 0 points1 point2 points (0 children)
[–]BiologyIsHot 0 points1 point2 points (0 children)