$npx skillfedfor your agent

greenback

Reenter an async event loop from synchronous code

With conditionsPyPI Application FrameworksReleased Dec 20259.6M downloads / moMIT -or- Apache License 2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — greenback-1.3.0-py3-none-any.whl
v1.3.0 · released 2025-12-23 · Python >=3.8 · 3 runtime deps: greenlet, sniffio, outcome

Yes, if you need to migrate existing sync code to async incrementally or interoperate with non-async libraries without threading. The library is actively maintained, has no known vulnerabilities, low install friction, and is permissively licensed. The main trade-off is a small performance cost per task and the requirement that C extensions used alongside greenback must be well-behaved. For greenfield async projects, it's unnecessary; for bridging sync and async, it's a solid choice.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.8+.
  • Greenlet must be available; works on CPython and PyPy but not other implementations.
  • Poorly-behaved C extensions may crash when used with greenback.

License · maintenance · safety

MIT -or- Apache License 2.0 (permissive) — Dual-licensed under MIT or Apache 2.0 (permissive). You may choose either license for your use, giving flexibility for both proprietary and open-source projects.

last release 2025-12-23 (234 days) · last repo commit 2026-02-17 · 92 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 9,609,038 downloads/mo, #1,520 on PyPI

Verify before relying

import greenback

async def main():
    await greenback.ensure_portal()
    result = greenback.await_(some_async_function())

await main()
  • Whether the minor performance impact of running tasks inside a greenlet is acceptable for your specific workload.
  • Compatibility with C extension modules in your dependency tree—greenback may expose latent bugs in extensions that violate greenlet's assumptions about heap allocation.
  • Whether greenback.await_() works reliably with all async frameworks beyond asyncio and Trio.
Same gist for agents: .md · .json

What it is and what it does

Greenback solves the problem of incrementally migrating a synchronous codebase to async/await syntax. When you port code to asyncio or Trio, you typically must convert every function in the call chain to async, even if most of them don't perform I/O themselves. Greenback lets you call async functions from synchronous code, as long as that sync code was originally invoked from an async task that set up a greenback portal.

It works by running your async task inside a greenlet, then using greenlet's context-switching to jump back to the parent greenlet (which has direct access to the event loop) when you call greenback.await_(). The result or exception from the async call is then returned to the task greenlet. The library is pure Python on top of the mature greenlet C module, with minimal overhead.

Use it for

  • Incrementally port a large codebase to async/await one layer at a time, leaving middle-layer functions unchanged.
  • Interoperate with existing libraries that don't support async without spawning threads or rewriting their internals.
  • Design async APIs that need to block in places where await syntax is forbidden, such as property getters.
  • Call async functions from synchronous wrapper functions in a legacy codebase without full conversion.
  • Bridge between synchronous and asynchronous code paths within the same event loop task.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need to migrate existing sync code to async incrementally or interoperate with non-async libraries without threading.

The library is actively maintained, has no known vulnerabilities, low install friction, and is permissively licensed. The main trade-off is a small performance cost per task and the requirement that C extensions used alongside greenback must be well-behaved. For greenfield async projects, it's unnecessary; for bridging sync and async, it's a solid choice.

Install

greenback on PyPI

Before you install

Low friction: pure Python wheel with only three runtime dependencies (greenlet, sniffio, outcome). Actively maintained as of 2026-02-17 with 92 repository stars. Requires Python 3.8 or later and greenlet support (CPython and PyPy both work).

Requires Python 3.8+. Greenlet must be available; works on CPython and PyPy but not other implementations. Poorly-behaved C extensions may crash when used with greenback.

License in practice

Dual-licensed under MIT or Apache 2.0 (permissive). You may choose either license for your use, giving flexibility for both proprietary and open-source projects.

Quickstart

import greenback

async def main():
    await greenback.ensure_portal()
    result = greenback.await_(some_async_function())

await main()

Verify before relying

  • Whether the minor performance impact of running tasks inside a greenlet is acceptable for your specific workload.
  • Compatibility with C extension modules in your dependency tree—greenback may expose latent bugs in extensions that violate greenlet's assumptions about heap allocation.
  • Whether greenback.await_() works reliably with all async frameworks beyond asyncio and Trio.

Package facts

LicenseMIT -or- Apache License 2.0 permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
3 packages
greenletsniffiooutcome
MaintenanceActively maintained 234 days since the last release
Last repo commit
First released
Downloads9,609,038 / month, #1,520 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaFramework :: AsyncIOFramework :: TrioLicense :: OSI Approved :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Evidence: greenback-1.3.0-py3-none-any.whl

Tags

Capabilities
call async from sync codeasyncio sync bridgeevent loop reentryasync await from synchronous functiongreenlet async interopmigrate to async incrementallysync wrapper for async code
Topics
async-migrationgreenlet-basedevent-loop-interop
PyPI keywords
asynciotrioasyncio

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 › “call async from sync code”

  • greenbackAllows you to call async functions from synchronous code that runs…
  • asyncerAsyncer provides utility functions for working with async/await code…
  • syncerSyncer converts async functions to synchronous callables, allowing…

Give your agent the search over MCP, or paste the wish link into any chat.

More Application Frameworks packages

fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

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.

MITpure Python · 3.9+
456.2Mdownloads / mo
textual Worth it
PyPI · Application Frameworks · released Jun 2026

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.

MITpure Python
443.6Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

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.

MITpure Python · 3.10+
369.3Mdownloads / mo
mcp Worth it
PyPI · Application Frameworks · released Jul 2026

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.

MITpure Python · 3.10+
319.3Mdownloads / mo
Werkzeug Worth it
PyPI · Application Frameworks · released Apr 2026

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.

BSD-3-Clausepure Python · 3.9+
268.1Mdownloads / mo

See also greenlet · async_generator · duet · gevent · threadloop · asyncgui · sniffio · synchronicity · asyncer · culsans