{"id":19913619,"url":"https://github.com/255bits/pg-async-events","last_synced_at":"2026-02-08T13:03:56.009Z","repository":{"id":255438266,"uuid":"850740479","full_name":"255BITS/pg-async-events","owner":"255BITS","description":"A simple event notification system, pubsub using PostgreSQL","archived":false,"fork":false,"pushed_at":"2024-09-04T05:42:43.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-03T01:39:06.730Z","etag":null,"topics":["events","postgresql","pubsub"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/255BITS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-01T16:41:50.000Z","updated_at":"2024-09-04T05:41:46.000Z","dependencies_parsed_at":"2025-05-03T05:31:05.218Z","dependency_job_id":null,"html_url":"https://github.com/255BITS/pg-async-events","commit_stats":null,"previous_names":["255bits/pg-async-events"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/255BITS/pg-async-events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/255BITS%2Fpg-async-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/255BITS%2Fpg-async-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/255BITS%2Fpg-async-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/255BITS%2Fpg-async-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/255BITS","download_url":"https://codeload.github.com/255BITS/pg-async-events/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/255BITS%2Fpg-async-events/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29230763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T12:28:20.184Z","status":"ssl_error","status_checked_at":"2026-02-08T12:28:19.510Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["events","postgresql","pubsub"],"created_at":"2024-11-12T21:33:33.684Z","updated_at":"2026-02-08T13:03:55.995Z","avatar_url":"https://github.com/255BITS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg-async-events\n\nA simple asynchronous event handling library using PostgreSQL notifications. This library allows you to subscribe to and publish events using PostgreSQL's `LISTEN/NOTIFY` mechanism in an asynchronous environment.\n\nThis is useful in generative AI applications or for situations where other pub/sub systems are overkill.\n\n## Features\n\n- **Asynchronous Event Handling:** Leverage `asyncio` and `asyncpg` to handle events without blocking your main application logic.\n- **PostgreSQL Notifications:** Seamlessly integrates with PostgreSQL's `LISTEN/NOTIFY` to provide real-time event notifications.\n- **Simple API:** Easy-to-use API for subscribing to channels and notifying events.\n\n## Installation\n\nYou can install the package directly from PyPI:\n\n```bash\npip install pg_async_events\n```\n\n## Usage\n\n### Quart\n\n```python\nimport asyncpg\nimport pg_async_events as events\n\n# Add your postgres credentials from the env\ndb_config = {\n    \"user\": POSTGRES_USER,\n    \"password\": POSTGRES_PASSWORD,\n    \"host\": POSTGRES_HOST,\n    \"port\": POSTGRES_PORT,\n    \"min_size\": 1,\n    \"max_size\": 5,\n}\n\n@app.before_serving\nasync def setup():\n    pool = await asyncpg.create_pool(**db_config)\n    await events.initialize(pool)\n```\n\n\n## Notifications\n\n```python\nimport pg_async_events as events\n\nasync def listen_to_events():\n    async for message in events.subscribe('your_channel'):\n        print('Received:', message)\n\nasync def publish_event():\n    payload = {'key': 'value'}\n    await events.notify('your_channel', payload)\n```\n\n## Requirements\n- Python 3.8+\n- PostgreSQL 9.0+ (with support for LISTEN/NOTIFY)\n- asyncpg library\n\n## Author\n\nBuilt by [255labs.xyz](https://255labs.xyz), the AI product and consulting startup helping people adapt to the AI age with consulting, product, and open-source development.\n\n## Contributing\n\nContributions are welcome! Please submit a pull request or open an issue to discuss the changes.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Thanks\n\n* asyncpg for providing the asynchronous PostgreSQL driver.\n* PostgreSQL community for their robust database and features like LISTEN/NOTIFY.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F255bits%2Fpg-async-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F255bits%2Fpg-async-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F255bits%2Fpg-async-events/lists"}