jcao219 jcao219 - 1 year ago 118
Python Question

A decent Python 3 IRC library?

Is there a decent IRC library for Python 3?

Answer Source

Since this is what you eventually find on google when searching for "Python 3 irc library" (I did), let me provide you some more variety. Here's an most propably incomplete overview:

  • The above mentioned Lurklib (example). A threading-safe, event-driven library that uses an own event-loop, which apparently has some bugs and will propably not work together with other async libraries. It was last updated on 31 May 2012, so I wouldn't recommend it.
  • My favorite: IRC3 (examples). A "plugable", event-driven library. Active development. Based on asyncio, therefore no 3rd-party library requirements and compatible with other asyncio(-like) libraries. Lets you define and run bots/apps in a neat way with configuration files/dicts. Good extensibility and very feature-rich, especially for bot-functionality (@command decorator for example). Is available in the default repository, so installable with pip install irc3.
  • pydle (examples). Event-driven and based on Tornado, therefore compatible with asyncio. Active-ly development; Feels mature and is kept up-to-date with the IRCv3 spec. Similar to IRC3, also very modular feature-wise. Not as feature-rich as IRC3, but probably sufficient for most people.
  • PyIRC (Website, examples). "PyIRC is nothing more than a way to turn IRC commands into callbacks and accessible data." Event-driven and compatible with multiple event-loops, including asyncio. Active development. Similar architecture as the others, but more low-level. Propably a choice for you if you like to built everything on top of the IRC implementation yourself and are fine with crawling through the documentation.

I recommend reading a bit into the docs and/or looking at examples, because I do not have in-depth experience with any of these libraries.

EDIT: I forgot the most obvious one: the IRC library. This one also strives to not be a framework, but just a nice event-driven abstraction library. Feels very natural and pythonic (for example the dynamic dispatching of IRC-events to on_? methods). If you don't really know what you want yourself, this is propably your default choice.