{"id":13616916,"url":"https://github.com/jaraco/irc","last_synced_at":"2025-05-14T01:03:32.756Z","repository":{"id":39917012,"uuid":"46566669","full_name":"jaraco/irc","owner":"jaraco","description":"Full-featured Python IRC library for Python.","archived":false,"fork":false,"pushed_at":"2025-02-26T23:34:15.000Z","size":5401,"stargazers_count":403,"open_issues_count":29,"forks_count":87,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-03T23:08:32.009Z","etag":null,"topics":["irc","python"],"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/jaraco.png","metadata":{"files":{"readme":"README.rst","changelog":"NEWS.rst","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"tidelift":"pypi/irc"}},"created_at":"2015-11-20T14:30:42.000Z","updated_at":"2025-03-22T17:30:48.000Z","dependencies_parsed_at":"2024-04-17T23:24:57.426Z","dependency_job_id":"de37c92e-961a-448d-b5e6-c140428e0b13","html_url":"https://github.com/jaraco/irc","commit_stats":{"total_commits":1414,"total_committers":65,"mean_commits":"21.753846153846155","dds":"0.18528995756718525","last_synced_commit":"ff26bfdca98e6e765ce2ea6c3699d5e275e88720"},"previous_names":[],"tags_count":152,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaraco%2Firc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaraco%2Firc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaraco%2Firc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaraco%2Firc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaraco","download_url":"https://codeload.github.com/jaraco/irc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328665,"owners_count":21085365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["irc","python"],"created_at":"2024-08-01T20:01:34.741Z","updated_at":"2025-05-14T01:03:32.749Z","avatar_url":"https://github.com/jaraco.png","language":"Python","readme":".. image:: https://img.shields.io/pypi/v/irc.svg\n   :target: https://pypi.org/project/irc\n\n.. image:: https://img.shields.io/pypi/pyversions/irc.svg\n\n.. image:: https://github.com/jaraco/irc/actions/workflows/main.yml/badge.svg\n   :target: https://github.com/jaraco/irc/actions?query=workflow%3A%22tests%22\n   :alt: tests\n\n.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\n    :target: https://github.com/astral-sh/ruff\n    :alt: Ruff\n\n.. image:: https://readthedocs.org/projects/irc/badge/?version=latest\n   :target: https://irc.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/badge/skeleton-2025-informational\n   :target: https://blog.jaraco.com/skeleton\n\n.. image:: https://badges.gitter.im/jaraco/irc.svg\n   :alt: Join the chat at https://gitter.im/jaraco/irc\n   :target: https://gitter.im/jaraco/irc?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\n\n.. image:: https://tidelift.com/badges/github/jaraco/irc\n   :target: https://tidelift.com/subscription/pkg/pypi-irc?utm_source=pypi-irc\u0026utm_medium=referral\u0026utm_campaign=readme\n\nFull-featured Python IRC library for Python.\n\n- `Project home \u003chttps://github.com/jaraco/irc\u003e`_\n- `Docs \u003chttps://python-irc.readthedocs.io/\u003e`_\n- `History \u003chttps://python-irc.readthedocs.io/en/latest/history.html\u003e`_\n\nOverview\n========\n\nThis library provides a low-level implementation of the IRC protocol for\nPython.  It provides an event-driven IRC client framework.  It has\na fairly thorough support for the basic IRC protocol, CTCP, and DCC\nconnections.\n\nIn order to understand how to make an IRC client, it's best to read up first\non the `IRC specifications\n\u003chttp://web.archive.org/web/20160628193730/http://www.irchelp.org/irchelp/rfc/\u003e`_.\n\nClient Features\n===============\n\nThe main features of the IRC client framework are:\n\n* Abstraction of the IRC protocol.\n* Handles multiple simultaneous IRC server connections.\n* Handles server PONGing transparently.\n* Messages to the IRC server are done by calling methods on an IRC\n  connection object.\n* Messages from an IRC server triggers events, which can be caught\n  by event handlers.\n* Multiple options for reading from and writing to an IRC server:\n  you can use sockets in an internal ``select()`` loop OR use\n  Python3's asyncio event loop\n* Functions can be registered to execute at specified times by the\n  event-loop.\n* Decodes CTCP tagging correctly (hopefully); I haven't seen any\n  other IRC client implementation that handles the CTCP\n  specification subtleties.\n* A kind of simple, single-server, object-oriented IRC client class\n  that dispatches events to instance methods is included.\n* DCC connection support.\n\nCurrent limitations:\n\n* The IRC protocol shines through the abstraction a bit too much.\n* Data is not written asynchronously to the server (and DCC peers),\n  i.e. the ``write()`` may block if the TCP buffers are stuffed.\n* Like most projects, documentation is lacking ...\n* DCC is not currently implemented in the asyncio-based version\n\nUnfortunately, this library isn't as well-documented as I would like\nit to be.  I think the best way to get started is to read and\nunderstand the example program ``irccat``, which is included in the\ndistribution.\n\nThe following modules might be of interest:\n\n* ``irc.client``\n\n  The library itself.  Read the code along with comments and\n  docstrings to get a grip of what it does.  Use it at your own risk\n  and read the source, Luke!\n\n* ``irc.client_aio``\n\n  All the functionality of the above library, but utilizing\n  Python 3's native asyncio library for the core event loop.\n  Interface/API is otherwise functionally identical to the classes\n  in ``irc.client``\n\n* ``irc.bot``\n\n  An IRC bot implementation.\n\n* ``irc.server``\n\n  A basic IRC server implementation. Suitable for testing, but not\n  intended as a production service.\n\n  Invoke the server with ``python -m irc.server``.\n\nExamples\n========\n\nExample scripts in the scripts directory:\n\n* ``irccat``\n\n  A simple example of how to use the IRC client.  ``irccat`` reads\n  text from stdin and writes it to a specified user or channel on\n  an IRC server.\n\n* ``irccat2``\n\n  The same as above, but using the ``SimpleIRCClient`` class.\n\n* ``aio_irccat``\n\n  Same as above, but uses the asyncio-based event loop in\n  ``AioReactor`` instead of the ``select()`` based ``Reactor``.\n\n\n* ``aio_irccat2``\n\n  Same as above, but using the ``AioSimpleIRCClient`` class\n\n\n* ``servermap``\n\n  Another simple example.  ``servermap`` connects to an IRC server,\n  finds out what other IRC servers there are in the net and prints\n  a tree-like map of their interconnections.\n\n* ``testbot``\n\n  An example bot that uses the ``SingleServerIRCBot`` class from\n  ``irc.bot``.  The bot enters a channel and listens for commands in\n  private messages or channel traffic.  It also accepts DCC\n  invitations and echos back sent DCC chat messages.\n\n* ``dccreceive``\n\n  Receives a file over DCC.\n\n* ``dccsend``\n\n  Sends a file over DCC.\n\n\nNOTE: If you're running one of the examples on a unix command line, you need\nto escape the ``#`` symbol in the channel. For example, use ``\\\\#test`` or\n``\"#test\"`` instead of ``#test``.\n\n\nScheduling Events\n=================\n\nThe library includes a default event Scheduler as\n``irc.schedule.DefaultScheduler``,\nbut this scheduler can be replaced with any other scheduler. For example,\nto use the `schedule \u003chttps://pypi.org/project/schedule\u003e`_ package,\ninclude it\nin your dependencies and install it into the IRC library as so:\n\n    class ScheduleScheduler(irc.schedule.IScheduler):\n        def execute_every(self, period, func):\n            schedule.every(period).do(func)\n\n        def execute_at(self, when, func):\n            schedule.at(when).do(func)\n\n        def execute_after(self, delay, func):\n            raise NotImplementedError(\"Not supported\")\n\n        def run_pending(self):\n            schedule.run_pending()\n\n    irc.client.Reactor.scheduler_class = ScheduleScheduler\n\n\nDecoding Input\n==============\n\nBy default, the IRC library attempts to decode all incoming streams as\nUTF-8, even though the IRC spec stipulates that no specific encoding can be\nexpected. Since assuming UTF-8 is not reasonable in the general case, the IRC\nlibrary provides options to customize decoding of input by customizing the\n``ServerConnection`` class. The ``buffer_class`` attribute on the\n``ServerConnection`` determines which class is used for buffering lines from the\ninput stream, using the ``buffer`` module in `jaraco.stream\n\u003chttps://pypi.python.org/pypi/jaraco.stream\u003e`_. By default it is\n``buffer.DecodingLineBuffer``, but may be\nre-assigned with another class, following the interface of ``buffer.LineBuffer``.\nThe ``buffer_class`` attribute may be assigned for all instances of\n``ServerConnection`` by overriding the class attribute.\n\nFor example:\n\n.. code:: python\n\n    from jaraco.stream import buffer\n\n    irc.client.ServerConnection.buffer_class = buffer.LenientDecodingLineBuffer\n\nThe ``LenientDecodingLineBuffer`` attempts UTF-8 but falls back to latin-1, which\nwill avoid ``UnicodeDecodeError`` in all cases (but may produce unexpected\nbehavior if an IRC user is using another encoding).\n\nThe buffer may be overridden on a per-instance basis (as long as it's\noverridden before the connection is established):\n\n.. code:: python\n\n    server = irc.client.Reactor().server()\n    server.buffer_class = buffer.LenientDecodingLineBuffer\n    server.connect()\n\nAlternatively, some clients may still want to decode the input using a\ndifferent encoding. To decode all input as latin-1 (which decodes any input),\nuse the following:\n\n.. code:: python\n\n    irc.client.ServerConnection.buffer_class.encoding = \"latin-1\"\n\nOr decode to UTF-8, but use a replacement character for unrecognized byte\nsequences:\n\n.. code:: python\n\n    irc.client.ServerConnection.buffer_class.errors = \"replace\"\n\nOr, to simply ignore all input that cannot be decoded:\n\n.. code:: python\n\n    class IgnoreErrorsBuffer(buffer.DecodingLineBuffer):\n        def handle_exception(self):\n            pass\n\n\n    irc.client.ServerConnection.buffer_class = IgnoreErrorsBuffer\n\nThe library requires text for message\nprocessing, so a decoding buffer must be used. Clients\nmust use one of the above techniques for decoding input to text.\n\nNotes and Contact Info\n======================\n\nEnjoy.\n\nMaintainer:\nJason R. Coombs \u003cjaraco@jaraco.com\u003e\n\nOriginal Author:\nJoel Rosdahl \u003cjoel@rosdahl.net\u003e\n\nCopyright © 1999-2002 Joel Rosdahl\nCopyright © 2011-2016 Jason R. Coombs\nCopyright © 2009 Ferry Boender\n\nFor Enterprise\n==============\n\nAvailable as part of the Tidelift Subscription.\n\nThis project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.\n\n`Learn more \u003chttps://tidelift.com/subscription/pkg/pypi-irc?utm_source=pypi-irc\u0026utm_medium=referral\u0026utm_campaign=github\u003e`_.\n","funding_links":["https://tidelift.com/funding/github/pypi/irc","https://tidelift.com/badges/github/jaraco/irc","https://tidelift.com/subscription/pkg/pypi-irc?utm_source=pypi-irc\u0026utm_medium=referral\u0026utm_campaign=readme","https://tidelift.com/subscription/pkg/pypi-irc?utm_source=pypi-irc\u0026utm_medium=referral\u0026utm_campaign=github"],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaraco%2Firc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaraco%2Firc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaraco%2Firc/lists"}