{"id":21063,"library":"connection-pool","title":"Connection Pool","description":"A minimal thread-safe connection pool for Python, providing a generic pool for any reusable connections (e.g., database sockets, HTTP clients). Version 0.0.3 is the latest release as of early 2025; the project appears to be in maintenance mode with no recent updates.","status":"maintenance","version":"0.0.3","language":"python","source_language":"en","source_url":"https://github.com/zhouyl/ConnectionPool","tags":["connection-pool","thread-safe","concurrency"],"install":[{"cmd":"pip install connection-pool","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"Pool","correct":"from connection_pool import ConnectionPool"}],"quickstart":{"code":"from connection_pool import ConnectionPool\n\n# Create a pool with a factory function for connections\npool = ConnectionPool(\n    max_size=5,\n    create=lambda: {'conn': 'example'},\n    close=lambda conn: None\n)\n\n# Acquire a connection\nwith pool.acquire() as conn:\n    # Use the connection\n    print(conn)\n    pass\n\n# Connections are returned automatically","lang":"python","description":"Basic usage of ConnectionPool with context manager."},"warnings":[{"fix":"Implement your own validation before returning connections to the pool.","message":"The library does not support connection validation or health checks. If a connection is broken after acquisition, the pool does not detect it.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using more robust pools like SQLAlchemy's or redis-py's connection pool for production.","message":"The library uses a simple list-based queue which may not be suitable for high-concurrency scenarios. Performance may degrade under heavy load.","severity":"gotcha","affected_versions":"all"},{"fix":"Always specify a timeout when acquiring connections: `pool.acquire(timeout=5)`.","message":"The `acquire()` method will block indefinitely if the pool is exhausted and no timeout is set. This can cause deadlocks.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with `pip install connection-pool` and import as `from connection_pool import ConnectionPool`.","cause":"Using wrong import path (hyphen instead of underscore). The package slug is 'connection-pool' but import uses underscore.","error":"ModuleNotFoundError: No module named 'connection_pool'"},{"fix":"Use `pool.acquire()` to obtain a connection.","cause":"Attempting to use a method that does not exist. The correct API is `pool.acquire()`","error":"connection_pool.ConnectionPool object has no attribute 'get_connection'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}