pydle


Namepydle JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryA compact, flexible, and standards-abiding IRC library for python3.
upload_time2025-07-27 21:22:48
maintainerpolyfloyd
docs_urlNone
authorShiz
requires_python>=3.10
licenseBSD-3-Clause
keywords irc library python3 compact flexible
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            pydle
=====
Python IRC library.
-------------------

pydle is a compact, flexible and standards-abiding IRC library for Python 3.10+.

Features
--------
* Well-organized: Thanks to the modularized feature system, it's not hard to find what you're looking for in the well-organised source code.
* Standards-abiding: Based on [RFC1459](https://tools.ietf.org/html/rfc1459.html) with some small extension tweaks, with full support of optional extension standards:
  - [TLS](http://tools.ietf.org/html/rfc5246)
  - [CTCP](http://www.irchelp.org/irchelp/rfc/ctcpspec.html)
  - (coming soon) [DCC](http://www.irchelp.org/irchelp/rfc/dccspec.html) and extensions
  - [ISUPPORT/PROTOCTL](http://tools.ietf.org/html/draft-hardy-irc-isupport-00)
  - [IRCv3.1](http://ircv3.net) (full)
  - [IRCv3.2](http://ircv3.net) (base complete, most optional extensions)
  - [IRCv3.3](http://ircv3.net) (base in progress)
* Asynchronous: IRC is an asynchronous protocol and so should be a library that implements it. Coroutines are used to process events from the server asynchronously.
* Modularised and extensible: Features on top of RFC1459 are implemented as separate modules for a user to pick and choose, and write their own. Broad features are written to be as extensible as possible.
* Liberally licensed: The 3-clause BSD license ensures you can use it everywhere.

Basic Usage
-----------
`pip install pydle`

From there, you can `import pydle` and subclass `pydle.Client` for your own functionality.

> To enable SSL support, install the `sasl` extra.
> `pip install pydle[sasl]`

Setting a nickname and starting a connection over TLS:
```python
import pydle

# Simple echo bot.
class MyOwnBot(pydle.Client):
    async def on_connect(self):
         await self.join('#bottest')

    async def on_message(self, target, source, message):
         # don't respond to our own messages, as this leads to a positive feedback loop
         if source != self.nickname:
            await self.message(target, message)

client = MyOwnBot('MyBot', realname='My Bot')
client.run('irc.rizon.net', tls=True, tls_verify=False)
```

*But wait, I want to handle multiple clients!*

No worries! Use `pydle.ClientPool` like such:
```python
pool = pydle.ClientPool()
for i in range(10):
    client = MyOwnBot('MyBot' + str(i))
    pool.connect(client, 'irc.rizon.net', 6697, tls=True, tls_verify=False)

# This will make sure all clients are treated in a fair way priority-wise.
pool.handle_forever()
```

Furthermore, since pydle is simply `asyncio`-based, you can run the client in your own event loop, like this:
```python
import asyncio

client = MyOwnBot('MyBot')
asyncio.run(client.connect('irc.rizon.net', tls=True, tls_verify=False))
```


Customization
-------------

If you want to customize bot features, you can subclass `pydle.BasicClient` and one or more features from `pydle.features` or your own feature classes, like such:
```python
# Only support RFC1459 (+small features), CTCP and our own ACME extension to IRC.
class MyFeaturedBot(pydle.features.ctcp.CTCPSupport, acme.ACMESupport, rfc1459.RFC1459Support):
    pass
```

To create your own features, just subclass from `pydle.BasicClient` and start adding callbacks for IRC messages:
```python
# Support custom ACME extension.
class ACMESupport(pydle.BasicClient):
    async def on_raw_999(self, source, params):
        """ ACME's custom 999 numeric tells us to change our nickname. """
        nickname = params[0]
        await self.set_nickname(nickname)
```

FAQ
---

**Q: When constructing my own client class from several base classes, I get the following error: _TypeError: Cannot create a consistent method resolution order (MRO) for bases X, Y, Z_. What causes this and how can I solve it?**

Pydle's use of class inheritance as a feature model may cause method resolution order conflicts if a feature inherits from a different feature, while a class inherits from both the original feature and the inheriting feature. To solve such problem, pydle offers a `featurize` function that will automatically put all classes in the right order and create an appropriate base class:
```python
# Purposely mis-ordered base classes, as SASLSupport inherits from CapabilityNegotiationSupport, but everything works fine.
MyBase = pydle.featurize(pydle.features.CapabilityNegotiationSupport, pydle.features.SASLSupport)
class Client(MyBase):
    pass
```

**Q: How do I...?**

Stop! Read the [documentation](http://pydle.readthedocs.org) first. If you're still in need of support, please [raise a new issue](https://github.com/Shizmob/pydle/issues/new) in this repository! Also, we are on IRC! We hang at `#pydle` on `irc.libera.chat`. If someone is around, they'll most likely gladly help you.

License
-------

Pydle is licensed under the 3-clause BSD license. See LICENSE.md for details.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pydle",
    "maintainer": "polyfloyd",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "floyd@polyfloyd.net",
    "keywords": "irc, library, python3, compact, flexible",
    "author": "Shiz",
    "author_email": "hi@shiz.me",
    "download_url": "https://files.pythonhosted.org/packages/71/b3/f52fac7b3e2492bfa064d41e1763a7692e4e37eb210b4293239c6e56a81c/pydle-1.1.0.tar.gz",
    "platform": null,
    "description": "pydle\n=====\nPython IRC library.\n-------------------\n\npydle is a compact, flexible and standards-abiding IRC library for Python 3.10+.\n\nFeatures\n--------\n* Well-organized: Thanks to the modularized feature system, it's not hard to find what you're looking for in the well-organised source code.\n* Standards-abiding: Based on [RFC1459](https://tools.ietf.org/html/rfc1459.html) with some small extension tweaks, with full support of optional extension standards:\n  - [TLS](http://tools.ietf.org/html/rfc5246)\n  - [CTCP](http://www.irchelp.org/irchelp/rfc/ctcpspec.html)\n  - (coming soon) [DCC](http://www.irchelp.org/irchelp/rfc/dccspec.html) and extensions\n  - [ISUPPORT/PROTOCTL](http://tools.ietf.org/html/draft-hardy-irc-isupport-00)\n  - [IRCv3.1](http://ircv3.net) (full)\n  - [IRCv3.2](http://ircv3.net) (base complete, most optional extensions)\n  - [IRCv3.3](http://ircv3.net) (base in progress)\n* Asynchronous: IRC is an asynchronous protocol and so should be a library that implements it. Coroutines are used to process events from the server asynchronously.\n* Modularised and extensible: Features on top of RFC1459 are implemented as separate modules for a user to pick and choose, and write their own. Broad features are written to be as extensible as possible.\n* Liberally licensed: The 3-clause BSD license ensures you can use it everywhere.\n\nBasic Usage\n-----------\n`pip install pydle`\n\nFrom there, you can `import pydle` and subclass `pydle.Client` for your own functionality.\n\n> To enable SSL support, install the `sasl` extra.\n> `pip install pydle[sasl]`\n\nSetting a nickname and starting a connection over TLS:\n```python\nimport pydle\n\n# Simple echo bot.\nclass MyOwnBot(pydle.Client):\n    async def on_connect(self):\n         await self.join('#bottest')\n\n    async def on_message(self, target, source, message):\n         # don't respond to our own messages, as this leads to a positive feedback loop\n         if source != self.nickname:\n            await self.message(target, message)\n\nclient = MyOwnBot('MyBot', realname='My Bot')\nclient.run('irc.rizon.net', tls=True, tls_verify=False)\n```\n\n*But wait, I want to handle multiple clients!*\n\nNo worries! Use `pydle.ClientPool` like such:\n```python\npool = pydle.ClientPool()\nfor i in range(10):\n    client = MyOwnBot('MyBot' + str(i))\n    pool.connect(client, 'irc.rizon.net', 6697, tls=True, tls_verify=False)\n\n# This will make sure all clients are treated in a fair way priority-wise.\npool.handle_forever()\n```\n\nFurthermore, since pydle is simply `asyncio`-based, you can run the client in your own event loop, like this:\n```python\nimport asyncio\n\nclient = MyOwnBot('MyBot')\nasyncio.run(client.connect('irc.rizon.net', tls=True, tls_verify=False))\n```\n\n\nCustomization\n-------------\n\nIf you want to customize bot features, you can subclass `pydle.BasicClient` and one or more features from `pydle.features` or your own feature classes, like such:\n```python\n# Only support RFC1459 (+small features), CTCP and our own ACME extension to IRC.\nclass MyFeaturedBot(pydle.features.ctcp.CTCPSupport, acme.ACMESupport, rfc1459.RFC1459Support):\n    pass\n```\n\nTo create your own features, just subclass from `pydle.BasicClient` and start adding callbacks for IRC messages:\n```python\n# Support custom ACME extension.\nclass ACMESupport(pydle.BasicClient):\n    async def on_raw_999(self, source, params):\n        \"\"\" ACME's custom 999 numeric tells us to change our nickname. \"\"\"\n        nickname = params[0]\n        await self.set_nickname(nickname)\n```\n\nFAQ\n---\n\n**Q: When constructing my own client class from several base classes, I get the following error: _TypeError: Cannot create a consistent method resolution order (MRO) for bases X, Y, Z_. What causes this and how can I solve it?**\n\nPydle's use of class inheritance as a feature model may cause method resolution order conflicts if a feature inherits from a different feature, while a class inherits from both the original feature and the inheriting feature. To solve such problem, pydle offers a `featurize` function that will automatically put all classes in the right order and create an appropriate base class:\n```python\n# Purposely mis-ordered base classes, as SASLSupport inherits from CapabilityNegotiationSupport, but everything works fine.\nMyBase = pydle.featurize(pydle.features.CapabilityNegotiationSupport, pydle.features.SASLSupport)\nclass Client(MyBase):\n    pass\n```\n\n**Q: How do I...?**\n\nStop! Read the [documentation](http://pydle.readthedocs.org) first. If you're still in need of support, please [raise a new issue](https://github.com/Shizmob/pydle/issues/new) in this repository! Also, we are on IRC! We hang at `#pydle` on `irc.libera.chat`. If someone is around, they'll most likely gladly help you.\n\nLicense\n-------\n\nPydle is licensed under the 3-clause BSD license. See LICENSE.md for details.\n\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A compact, flexible, and standards-abiding IRC library for python3.",
    "version": "1.1.0",
    "project_urls": {
        "Documentation": "https://pydle.readthedocs.io/",
        "issues": "https://github.com/shizmob/pydle/issues",
        "source": "https://github.com/shizmob/pydle"
    },
    "split_keywords": [
        "irc",
        " library",
        " python3",
        " compact",
        " flexible"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "088acd1a9b2f5e2e7e26c122ebdbc74f27b0b6767febc40032ead31b9a72a582",
                "md5": "8bc0800015c2f9323fffec8dbb819e71",
                "sha256": "60b30d987b67da3453cf35d27048e59ef3d09704d26c5a3199f50175b9f22dbe"
            },
            "downloads": -1,
            "filename": "pydle-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8bc0800015c2f9323fffec8dbb819e71",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 47552,
            "upload_time": "2025-07-27T21:22:47",
            "upload_time_iso_8601": "2025-07-27T21:22:47.144489Z",
            "url": "https://files.pythonhosted.org/packages/08/8a/cd1a9b2f5e2e7e26c122ebdbc74f27b0b6767febc40032ead31b9a72a582/pydle-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "71b3f52fac7b3e2492bfa064d41e1763a7692e4e37eb210b4293239c6e56a81c",
                "md5": "afc8a86c89c36bac7a82c3bc92ace7a2",
                "sha256": "019eabd94060c2e46f1a88f53571390bba4865f5b61ab2f3e98d637d649e40d1"
            },
            "downloads": -1,
            "filename": "pydle-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "afc8a86c89c36bac7a82c3bc92ace7a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 37792,
            "upload_time": "2025-07-27T21:22:48",
            "upload_time_iso_8601": "2025-07-27T21:22:48.227961Z",
            "url": "https://files.pythonhosted.org/packages/71/b3/f52fac7b3e2492bfa064d41e1763a7692e4e37eb210b4293239c6e56a81c/pydle-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-27 21:22:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shizmob",
    "github_project": "pydle",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "pydle"
}
        
Elapsed time: 1.30781s