A fast, lightweight, single-file Python WSGI framework with zero dependencies.
Project description
Lcore
A fast, lightweight, single-file Python WSGI framework with zero dependencies.
Inspired by the simplicity of Bottle.
Documentation • Getting Started • API Reference
Installation
uv add lcore # uv (recommended)
pip install lcore # pip
Quick Start
from lcore import Lcore
app = Lcore()
@app.route('/hello/<name>')
def hello(name):
return {'message': f'Hello, {name}!'}
app.run()
Key Features
- Single file, zero dependencies drop
lcore.pyinto any project - Full WSGI compliance works with Gunicorn, uWSGI, Waitress, and 17+ server adapters
- 7 built-in middleware CORS, CSRF, security headers, compression, body limits, request ID, logging
- Security primitives PBKDF2 password hashing, HMAC-SHA256 signed cookies, rate limiting
- Dependency injection singleton, scoped, and transient lifetimes
- Plugin system JSON serialization, template rendering, and custom plugins
- Request validation JSON body and query parameter validation with type checking
- Built-in test client unit test routes without starting a server
- 12 lifecycle hooks request start, auth, handler enter/exit, response build/send, and more
- Module mounting compose sub-applications with isolated routes and middleware
Full documentation at lcore.lusansapkota.com.np.
Performance
Benchmarked with 100,000 iterations × 3 runs per framework (best run recorded), single process, no I/O, measuring pure framework overhead:
| Framework | JSON (req/s) | Plaintext (req/s) |
|---|---|---|
| Lcore | 91,917 | 116,794 |
| Flask 3.1.3 | 22,757 | 25,497 |
| Bottle 0.13.4 | 138,299 | 187,334 |
Lcore processes 2.2x – 4.6x more requests per second than Flask across 7 test scenarios (plaintext, JSON, route params, middleware stack, 404 miss, multi-route dispatch, POST JSON). See the full benchmarks for details.
Run the benchmarks yourself:
pip install flask bottle
cd benchmarks && python benchmark.py --full
When NOT to Use Lcore
| Situation | Better choice |
|---|---|
| You need WebSockets or real-time async I/O | FastAPI, Starlette, Quart |
| You need true async concurrency (async DB drivers, hundreds of concurrent outbound HTTP calls) | FastAPI, Starlette |
| You need automatic OpenAPI / Swagger generation | FastAPI |
| You need ASGI and Uvicorn / Daphne | FastAPI, Starlette |
| You need a full MVC framework with ORM, admin panel, and migrations | Django |
| Your team is already on Flask and migration cost outweighs the benefit | Stay on Flask |
If your workload is primarily synchronous REST APIs, internal services, microservices with sync DB drivers Lcore is a strong fit.
License
MIT see LICENSE for details.
Built by Lusan Sapkota • Inspired by Bottle
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lcore-0.0.4.tar.gz.
File metadata
- Download URL: lcore-0.0.4.tar.gz
- Upload date:
- Size: 57.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
949f23929907413abbd6ece70456189a0b95797f17dc1450e7b388914a2bf1fa
|
|
| MD5 |
21c640fe0d6701c68b104dec6e54f1e4
|
|
| BLAKE2b-256 |
1d522f255d6022ab87b2a6112e918f401083559e9328cd0d7aaadbb1454cea16
|
File details
Details for the file lcore-0.0.4-py3-none-any.whl.
File metadata
- Download URL: lcore-0.0.4-py3-none-any.whl
- Upload date:
- Size: 57.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1ba31e7bb37a845703e1bfe2f7df2c4f0735a3e3125c910c9a00efd4b59e7ea
|
|
| MD5 |
9d5a71db15f05406ba7cd41984dabc20
|
|
| BLAKE2b-256 |
49d81c62985827e3efc23f7db4883410b95ec19f6f26f3b5465059174a51a761
|