duet
A simple future-based async library for python.
Decision gist · record as of 2026-08-14
Yes, if you need to integrate Future-based APIs (especially gRPC) into async code or are refactoring a codebase incrementally. The low install friction, permissive license, and re-entrancy feature make it a pragmatic choice for that niche. No known vulnerabilities. Not recommended as a general-purpose async framework.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9.0 or later.
- Low friction: pure Python wheel with a single runtime dependency (typing-extensions).
- Actively maintained with recent commits, though releases are infrequent—last update was over a year ago.
License · maintenance · safety
Apache 2 (permissive) — Apache 2 permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects.
last release 2023-07-26 (1115 days) · last repo commit 2026-03-20 · 27 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 391,821 downloads/mo, #7,010 on PyPI
Alternatives
Verify before relying
pip install duet
import duet
from concurrent.futures import Future
async def example():
future = Future()
result = await duet.AwaitableFuture(future)
return result
duet.run(example)- Whether re-entrancy works reliably with all async patterns or has edge cases not documented in the excerpt.
- Performance characteristics compared to asyncio or trio for typical workloads.
- Maturity and stability guarantees given the small repository (27 stars) and infrequent releases.
What it is and what it does
Duet is a minimal async library designed to bridge the gap between Future-based APIs (like gRPC) and Python's async/await syntax. Rather than implementing its own event loop, it wraps standard Future objects in awaitable wrappers so you can use them in async functions. The library takes inspiration from structured concurrency but differs in two key ways: it focuses on Future integration rather than full async I/O, and it allows re-entrant event loops—meaning you can call duet.run() from within code that's already running inside duet.run(), which most async libraries forbid. This re-entrancy can simplify gradual refactoring of codebases to async without requiring a complete separation of sync and async code upfront.
Duet depends only on typing-extensions and installs as a pure Python wheel, keeping overhead minimal. It's actively maintained but with infrequent releases; the last update was over a year ago. The library is not an official Google project, though it lives in the Google GitHub organization.
Use it for
- Wrapping gRPC or other RPC library futures to use them in async/await code without rewriting the underlying API.
- Gradually refactoring synchronous code to async by allowing re-entrant duet.run() calls during the transition.
- Building async wrappers around legacy libraries that return futures but lack native async support.
- Combining Future-based parallelism with structured concurrency patterns in a lightweight package.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to integrate Future-based APIs (especially gRPC) into async code or are refactoring a codebase incrementally.
The low install friction, permissive license, and re-entrancy feature make it a pragmatic choice for that niche. No known vulnerabilities. Not recommended as a general-purpose async framework.
Install
duet on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (typing-extensions). Actively maintained with recent commits, though releases are infrequent—last update was over a year ago.
Requires Python 3.9.0 or later.
License in practice
Apache 2 permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects.
Quickstart
pip install duet
import duet
from concurrent.futures import Future
async def example():
future = Future()
result = await duet.AwaitableFuture(future)
return result
duet.run(example)
Verify before relying
- Whether re-entrancy works reliably with all async patterns or has edge cases not documented in the excerpt.
- Performance characteristics compared to asyncio or trio for typical workloads.
- Maturity and stability guarantees given the small repository (27 stars) and infrequent releases.
Package facts
| License | Apache 2 permissive |
| Python support | Supports the current Python release >=3.9.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Actively maintained 1,115 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 391,821 / month, #7,010 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: duet-0.2.9-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “future-based async library”
- duetDuet is a lightweight async library that wraps Future objects to…
- hazelcast-python-clientHazelcast Python Client connects your Python application to a…
- async-interruptProvides an asyncio context manager that interrupts a block of code…
Give your agent the search over MCP, or paste the wish link into any chat.
More Application Frameworks packages
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.
Install it if you're developing CLI tools, dashboards, or interactive terminal applications.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.
Install it if you need to build or connect to servers.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
See also asyncgui · synchronicity · greenback · trio · unsync · anyio · futurist · requests-futures · vine · threadloop