--- id: psycogreen version: "1.0.2" license: BSD license_treatment: permissive maintenance: dormant --- # psycogreen — psycopg2 integration with coroutine libraries License: permissive · Maintenance: dormant · Downloads: 1.0M/mo ## What it is and what it does psycogreen provides wait callbacks that hook psycopg2 into coroutine event loops, enabling non-blocking database queries within gevent and eventlet applications. It works by registering callbacks with psycopg2's extension API so that when a database operation would block, control returns to the event loop instead of freezing the thread. The package offers two main modules: psycogreen.gevent for gevent integration and psycogreen.eventlet for eventlet integration. Each exposes a patch_psycopg() function and a corresponding wait callback. It is designed for applications that already use gevent or eventlet for concurrency and need their PostgreSQL queries to cooperate with that event loop rather than blocking. Use it for: - Run concurrent PostgreSQL queries in a gevent-based web application without blocking other greenlets. - Integrate psycopg2 into an eventlet application that needs non-blocking database access alongside other async I/O. - Avoid Eventlet's default monkeypatching by explicitly registering psycogreen's wait callback for finer control. - Enable uWSGI green thread applications to execute asynchronous database operations within the async platform. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Integrates psycopg2 with coroutine libraries (eventlet, gevent) by registering wait callbacks that allow asynchronous database operations within a blocking interface. Yes, if you are already committed to gevent or eventlet and need psycopg2 to cooperate with that event loop. No, if you are starting a new project—modern alternatives like asyncpg or psycopg3 with native async support are better choices. Caution: dormant maintenance (last release 2020) and source-only distribution mean you accept integration risk and potential compatibility issues with recent Python or psycopg2 versions. ## Install pip install psycogreen uv add psycogreen poetry add psycogreen ## Installing psycogreen Before you install: High install friction: source distribution only (psycogreen-1.0.2.tar.gz). Dormant maintenance—last release 2020-02-22, last commit 2023-12-04, no recent activity. Not actively maintained but repository remains open. License in practice: BSD license (permissive). No restrictions on commercial or private use; you may modify and redistribute under the same license terms. Quickstart: pip install psycogreen import psycogreen.gevent psycogreen.gevent.patch_psycopg() # or import psycogreen.eventlet psycogreen.eventlet.patch_psycopg() Requires psycopg2 to be installed separately. Requires either gevent or eventlet to be installed and active in your application. Verify before relying: - Compatibility with modern psycopg2 versions (package has not been released since 2020) - Whether gevent or eventlet monkey-patching approach is still the recommended pattern for async PostgreSQL in modern Python - Python 3.10+ support status (classifiers list Python 2 and 3 generically) ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: high - Maintenance: dormant - Downloads: 1.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags psycopg2 async coroutine integration, gevent eventlet postgresql adapter, async database calls psycopg2, coroutine library database support, non-blocking psycopg2 integration, async-integration, coroutine-support, legacy-maintained [View on SkillFed](https://skillfed.io/packages/psycogreen) · [View on PyPI](https://pypi.org/project/psycogreen/)