aiosqlite

Async/await-friendly wrapper around Python's built-in sqlite3 module for asyncio applications.

Library
PyPI
v0.22.1
1,576 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
40 /100 Fair
Development Activity 4
Maintenance 0
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 85
Code Quality 88
Innovation 62
Learning Curve 70

aiosqlite provides an asyncio-compatible interface to SQLite databases by wrapping the standard library’s sqlite3 module. It replicates sqlite3’s connection and cursor APIs almost exactly, but every method becomes an async coroutine, so applications built on asyncio can talk to SQLite without blocking the event loop.

Under the hood, aiosqlite runs a single dedicated worker thread per connection and funnels every query through a shared queue, guaranteeing that SQLite calls — which are not safe to use across arbitrary threads — happen serially on one thread while the asyncio event loop stays free to do other work. Context managers handle closing connections and cursors automatically, and the library also exposes convenience helpers like execute_fetchall and an async iterdump for common patterns.

What You Get

  • Async equivalents of sqlite3’s Connection and Cursor objects, with the same method names and semantics
  • A dedicated worker thread per connection that serializes SQLite calls off the event loop
  • Async context managers for connections and cursors that close resources automatically
  • Convenience helpers like execute_fetchall, execute_insert, and an async iterdump for streaming SQL dumps
  • A fully typed API (py.typed marker) for editor and mypy support

Common Use Cases

  • Adding SQLite persistence to an asyncio web service (e.g. FastAPI or aiohttp) without blocking request handling
  • Local caching or job-queue storage for async workers that need durable state
  • Prototyping and testing async data-access layers before moving to a networked database
  • Desktop, bot, or CLI asyncio apps (e.g. Textual TUIs, Discord bots) that need embedded, file-based storage

Under The Hood

Architecture aiosqlite is a small, cleanly layered module: core.py defines the Connection proxy, which owns a single background thread and a queue-based transaction pipeline; every sqlite3 call is wrapped as a partial and pushed onto that queue, executed serially on the worker thread, with results or exceptions marshalled back to the asyncio event loop through call_soon_threadsafe. cursor.py’s Cursor class is a thin proxy over sqlite3’s cursor that reuses the same execution plumbing and adds chunked async iteration for streaming query results. context.py supplies a decorator that wraps coroutine-returning methods in a dual-purpose object implementing both Coroutine and an async context manager, so a single method like execute() can be used as either a plain await or an async with block. This design cleanly isolates the one hard constraint — sqlite3 objects must be used from a single thread — behind an async-friendly interface, and the worker thread plus its queue is the abstraction everything else hinges on.

Tech Stack aiosqlite targets Python 3.9+ and has zero runtime dependencies beyond the standard library — the entire implementation is three small modules. Packaging uses flit_core as the build backend, docs are built with Sphinx and published to Read the Docs, and the dev toolchain (declared as optional dependencies) includes black, usort/ufmt for formatting, mypy for static typing, and flake8 with flake8-bugbear for linting. Continuous integration uses uv to install dependencies and runs the test/lint/build/publish pipeline across multiple Python versions on macOS, Ubuntu, and Windows, publishing to PyPI via trusted publishing on tagged releases.

Code Quality Tests live in a substantial smoke-test module built on the standard library’s IsolatedAsyncioTestCase rather than pytest, covering connection lifecycle, cursor iteration, error propagation, backup, iterdump, and authorizer callbacks, alongside a dedicated performance-test module; coverage configuration enforces a minimum threshold. Static analysis is enforced through mypy and flake8 with flake8-bugbear, both run in CI alongside the test matrix, and the package ships a py.typed marker so downstream consumers get type-checked signatures. Error handling favors letting sqlite3’s own exception types propagate unchanged — they’re re-exported directly from sqlite3 rather than wrapped — and naming conventions mirror the stdlib API closely for familiarity.

API Design aiosqlite’s core design goal is API parity with the synchronous sqlite3 module — Connection and Cursor expose the same method names with await added, so migrating existing sqlite3 code is largely mechanical. The dual coroutine/context-manager return type is the one genuinely distinctive ergonomic choice, letting the same call site work as a plain await or an async with block depending on whether the caller needs the cursor for iteration. Beyond that, aiosqlite deliberately stays a thin, familiar wrapper rather than introducing new query concepts or abstractions, which suits its scope but doesn’t set it apart technically from a straightforward thread-executor wrapper around sqlite3.

Used by 15 apps in this directory

Python
100%
Apache 2.0

Agno

AI Development · Automation · Devops

42,358

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python 100%
Updated 4 days ago
Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,125

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
61
Dependency
Built with
Python 59%
Jupyter Notebook 21%
Updated 1 weeks ago
C++
68%
Apache 2.0

ClickHouse

Analytics · Data Engineering · Databases

50,116

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
64
Dependency
Built with
C++ 68%
Python 14%
Updated 4 days ago
Python
99%
MIT

deepagents

AI Agents · AI Development

29,818

The batteries-included Python agent harness — planning, sub-agents, filesystem, shell, memory, and skills bundled in, built on LangGraph.

View details
88
Repo Health
83
Technical
70
Dependency
Built with
Python 99%
Updated 4 days ago
JavaScript
88%
GPL 3.0

Glass by Pickle

AI Assistants

7,604

A privacy-first desktop AI assistant that sees your screen, hears your meetings, and turns live context into structured summaries—without sending a single byte to the cloud.

View details
43
Repo Health
76
Technical
68
Dependency
Built with
JavaScript 88%
TypeScript 12%
Updated 11 months ago
TypeScript
55%
Other

Jaaz

AI Agents · AI Design Tools

6,670

Open-source AI creative agent that turns visual sketches and canvas gestures into images and videos — no text prompts required.

View details
48
Repo Health
59
Technical
71
Dependency
Built with
TypeScript 55%
Python 34%
JavaScript 10%
Updated 7 months ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,319

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 4 days ago
Python
51%
AGPL 3.0

LearnHouse

CMS · Learning Management

2,301

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
90
Repo Health
77
Technical
66
Dependency
Built with
Python 51%
TypeScript 48%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers