Skip to main content

Lcore

Lcore

A fast, lightweight, single-file Python WSGI framework with zero dependencies.
Inspired by the simplicity of Bottle.

Documentation • Getting Started • API Reference

Python 3.8+ v0.0.5 MIT Zero Dependencies


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.py into any project
  • Full WSGI compliance works with Gunicorn, uWSGI, Waitress, and 17+ server adapters
  • Concurrency without async/await run under the gevent/eventlet server adapters and ordinary synchronous handlers get real concurrency for free, no code changes. Measured: 200 concurrent requests to a 0.2s handler took 2.07s on a 20-thread server, 0.58s under gevent. async def handlers are accepted too, but do not provide concurrency under WSGI Lcore warns at first use of any async route.
  • 10 built-in middleware CORS, CSRF, sessions, security headers, compression, body limits, request ID, logging, proxy fix, timeouts
  • Server-side sessions revocable logins with memory, SQLite or Redis backends, sign-out-everywhere, and active device listing
  • 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 specifically need asyncio-native libraries (asyncpg, httpx, motor) with a persistent event loop 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. That includes high-concurrency I/O-bound workloads too, as long as they don't specifically need asyncio-native libraries: the gevent/eventlet server adapters give ordinary synchronous handlers real concurrency under slow I/O, with zero code changes.

License

MIT see LICENSE for details.


Built by Lusan Sapkota • Inspired by Bottle

Metadata

Release files for lcore 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lcore 0.0.5
File Size Uploaded
lcore-0.0.5.tar.gz 71.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lcore 0.0.5
File Interpreter ABI Platform
lcore-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 143.2 kB

Release files / lcore-0.0.5.tar.gz

Download URL lcore-0.0.5.tar.gz
Size 71.7 kB
Tags Source
SHA-256 checksum
How to use checksums
147ab092dc75464661613be8c234c7a8eaf55535a92cd3bd3ac4bc636992fd0d
BLAKE2b-256 checksum
How to use checksums
2615d8a43526409c6791ce01a39fe2e9d727f5d6532d2d8f9212998d475d8269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / lcore-0.0.5-py3-none-any.whl

Download URL lcore-0.0.5-py3-none-any.whl
Size 71.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8731a71b2c424670e454b34e9250577ef5d177a512980d538be57ba7d9d393c6
BLAKE2b-256 checksum
How to use checksums
26d64f9a16e8d974d7f2104244cbf727a2337268c053a16df44f0e169fdf49b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page