{"id":23901,"library":"irc","title":"irc","description":"IRC (Internet Relay Chat) protocol library for Python. Provides client and server implementations. Current version: 20.5.0. Release cadence: irregular, a few times per year.","status":"active","version":"20.5.0","language":"python","source_language":"en","source_url":"https://github.com/jaraco/irc","tags":["irc","chat","protocol","bot"],"install":[{"cmd":"pip install irc","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Used internally for functional utilities.","package":"jaraco.functools","optional":false},{"reason":"Used internally for collection utilities.","package":"jaraco.collections","optional":false},{"reason":"Used internally for text processing.","package":"jaraco.text","optional":false},{"reason":"Used internally for stream processing.","package":"jaraco.stream","optional":false},{"reason":"Used internally for iteration utilities.","package":"more-itertools","optional":false},{"reason":"Timezone handling for timestamp parsing.","package":"pytz","optional":false}],"imports":[{"note":"IRCClient is in the client module, not top-level.","wrong":"from irc import IRCClient","symbol":"IRCClient","correct":"from irc.client import IRCClient"},{"note":"ServerConnection is in the client module.","wrong":"from irc import ServerConnection","symbol":"ServerConnection","correct":"from irc.client import ServerConnection"}],"quickstart":{"code":"import irc.client\nimport os\n\nserver = 'irc.libera.chat'\nport = 6667\nnick = 'MyBot'\n\nclass MyClient(irc.client.SimpleIRCClient):\n    def on_welcome(self, connection, event):\n        connection.join('#testchannel')\n\n    def on_pubmsg(self, connection, event):\n        print(f\"{event.source.nick}: {event.arguments[0]}\")\n\nclient = MyClient()\nclient.connect(server, port, nick)\nclient.start()","lang":"python","description":"Basic IRC bot connecting to Libera.Chat and printing messages."},"warnings":[{"fix":"Use `from irc.client import IRCClient` instead of `from irc.client import IRC`.","message":"In v20.0.0, the `irc.client` module was restructured. `irc.client.IRC` is now `irc.client.IRCClient`. Old imports break.","severity":"breaking","affected_versions":"<20.0.0"},{"fix":"Update callback signatures to `def on_join(self, connection, event):`.","message":"In v20.0.0, `on_join`, `on_part`, etc. callbacks now receive `connection` and `event` arguments (previously different).","severity":"breaking","affected_versions":"<20.0.0"},{"fix":"Use an asynchronous event loop (e.g., `irc.client.aio`) or set `irc.client.ServerConnection.buffer_class = irc.buffer.LenientDecodingLineBuffer`.","message":"The library uses Python's `select` module by default, which does not support Windows' socket behaviour. On Windows, it may hang or fail.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure `pip install irc` succeeded and version >=20.0.0. Use `from irc import client` or `from irc.client import ...`.","cause":"Trying to import `irc.client` before installing the library or using a very old version where the module didn't exist.","error":"AttributeError: module 'irc' has no attribute 'client'"},{"fix":"Change method signature to `def on_welcome(self, connection, event):`.","cause":"Callback signature mismatch: old code expects 2 arguments (self, event) but new API passes 3 (self, connection, event).","error":"TypeError: on_welcome() takes 2 positional arguments but 3 were given"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}