{"id":27800,"library":"gh-rabbit-hole","title":"gh-rabbit-hole","description":"A Python library for simplified communication with RabbitMQ, providing a high-level wrapper around pika. Current version is 1.6.0, compatible with Python >=3.10. Release cadence is irregular; maintained by m-ghiani.","status":"active","version":"1.6.0","language":"python","source_language":"en","source_url":"https://github.com/m-ghiani/RABBIT_HOLE","tags":["rabbitmq","messaging","pika","wrapper"],"install":[{"cmd":"pip install gh-rabbit-hole","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"Core dependency for RabbitMQ protocol","package":"pika","optional":false}],"imports":[{"note":"Package uses snake_case 'rabbit_hole' for import, not hyphenated or underscored with gh prefix.","wrong":"from gh_rabbit_hole import RabbitHole","symbol":"RabbitHole","correct":"from rabbit_hole import RabbitHole"}],"quickstart":{"code":"import os\nfrom rabbit_hole import RabbitHole\n\n# Initialize with environment variables or direct connection params\nrh = RabbitHole(\n    host=os.environ.get('RABBIT_HOST', 'localhost'),\n    port=int(os.environ.get('RABBIT_PORT', 5672)),\n    username=os.environ.get('RABBIT_USER', 'guest'),\n    password=os.environ.get('RABBIT_PASS', 'guest')\n)\n\n# Declare a queue\nrh.declare_queue('test_queue')\n\n# Publish a message\nrh.publish('test_queue', {'message': 'hello world'})\n\n# Consume messages (callback)\ndef callback(ch, method, properties, body):\n    print(f\"Received: {body}\")\n    rh.ack(method.delivery_tag)\n\nrh.consume('test_queue', callback=callback, auto_ack=False)\n\n# Close connection\nrh.close()","lang":"python","description":"Connect to RabbitMQ, declare a queue, publish and consume a message."},"warnings":[{"fix":"Use 'from rabbit_hole import RabbitHole' instead of any old import path.","message":"In version 1.0.0, the library was renamed from 'gh-rabbit-hole' to 'rabbit_hole' for imports. The package name on PyPI remains 'gh-rabbit-hole'.","severity":"breaking","affected_versions":"<1.0.0 and >=1.0.0"},{"fix":"Always specify auto_ack=True or False explicitly when calling consume.","message":"The method 'consume' without auto_ack parameter defaults to False, but future versions may change default to True. Explicitly pass auto_ack to avoid breakage.","severity":"deprecated","affected_versions":"1.x"},{"fix":"Set timeout parameter explicitly, e.g., RabbitHole(..., timeout=5).","message":"If RabbitMQ is not running or connection fails, the library may hang indefinitely due to default timeout settings.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure payload is a JSON-serializable dict or a string.","message":"The 'publish' method expects a dict or string; passing other types may cause serialization errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from rabbit_hole import RabbitHole'","cause":"Incorrect import path; package uses 'rabbit_hole' for Python import, not hyphens or 'gh_rabbit_hole'.","error":"ModuleNotFoundError: No module named 'gh_rabbit_hole'"},{"fix":"Set correct credentials via environment variables RABBIT_USER, RABBIT_PASS, or create a virtual host and user in RabbitMQ.","cause":"Authentication failure or RabbitMQ server not configured for guest access from remote.","error":"pika.exceptions.AMQPConnectionError: Connection closed by remote server"},{"fix":"Convert payload to dict or string before publishing.","cause":"Passing non-serializable object to publish method.","error":"TypeError: Object of type X is not JSON serializable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}