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.6 MIT Zero Dependencies


Installation

uv add lcore          # uv (recommended)
pip install lcore     # pip
curl -O https://raw.githubusercontent.com/Lusan-sapkota/lcore/main/lcore.py   # single file

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 113,290 162,873
Flask 3.1.3 21,433 24,139
Bottle 0.13.4 127,035 174,801

Lcore processes 3.6x – 6.7x more requests per second than Flask across 7 test scenarios (plaintext, JSON, route params, middleware stack, 404 miss, multi-route dispatch, POST JSON), and is 1.9x faster than Bottle on 404 misses. Bottle is faster on the other tests (Lcore reaches 64% – 93% of its throughput) but ships none of the middleware, security or DI. Measured November 2026, Python 3.14, v0.0.6. 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.6

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.6
File Size Uploaded Provenance Actions
lcore-0.0.6.tar.gz 155.7 kB With provenance Details for lcore-0.0.6.tar.gz

Built distribution (wheel)

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

Total release size: 314.1 kB

Release files / lcore-0.0.6.tar.gz

Download URL lcore-0.0.6.tar.gz
Size 155.7 kB
Tags Source
SHA-256 checksum
How to use checksums
84b3b29870697bb2651a1f218f14f78ce62fa66d2f1249ad6770146d08a428b2
BLAKE2b-256 checksum
How to use checksums
d6469f12bd3468b89ef424232202a5baa747d59d4b678bfa69987e3286fa3e5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

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

Download URL lcore-0.0.6-py3-none-any.whl
Size 158.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2c60412ab9dfebd15e66ffbf3eaa24b4d7f93d15b65e4cd3e0c044459644b34
BLAKE2b-256 checksum
How to use checksums
1a5ee841a1f7df2ce6339f56286e5e66212b9446e126eed545499614879697a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for lcore 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lcore-0.0.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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