better-ipc


Namebetter-ipc JSON
Version 2.0.1 PyPI version JSON
download
home_pagehttps://github.com/MiroslavRosenov/better-ipc
SummaryA high-performance inter-process communication library designed to work with the latest version of discord.py
upload_time2022-12-06 12:05:56
maintainer
docs_urlNone
authorDaPandaOfficial
requires_python>=3.8.0
licenseMIT License
keywords better-ipc ipc python discord.py
VCS
bugtrack_url
requirements websockets
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Better IPC

<a href="https://pypi.org/project/better-ipc/" target="_blank"><img src="https://img.shields.io/pypi/v/better-ipc"></a>
<img src="https://img.shields.io/pypi/pyversions/better-ipc">
<img src="https://img.shields.io/github/last-commit/MiroslavRosenov/better-ipc">
<img src="https://img.shields.io/github/license/MiroslavRosenov/better-ipc">
<a href="https://discord.gg/Rpg7zjFYsh" target="_blank"><img src="https://img.shields.io/discord/875005644594372638?label=discord"></a>

## High-performance inter-process communication library designed to work with the latest version of [discord.py](https://github.com/Rapptz/discord.py)

<img src="https://raw.githubusercontent.com/MiroslavRosenov/better-ipc/main/banner.png">

This library is *based* on [discord-ext-ipc](https://github.com/Ext-Creators/discord-ext-ipc), which is no longer maintained.

# Installation
> ### Stable version
#### For Linux
```shell
python3 -m pip install -U better-ipc
```
#### For Windows
```shell
py -m pip install -U better-ipc
```

> ### Development version
#### For Linux
```shell
python3 -m pip install -U git+https://github.com/MiroslavRosenov/better-ipc
```
#### For Windows
```shell
py -m pip install -U git+https://github.com/MiroslavRosenov/better-ipc
```


# Support

[Support server](https://discord.gg/Rpg7zjFYsh)

[Official documentation](https://docs.better-ipc.xyz)

# Examples

### Client example
```python
import discord
from typing import Dict
from discord.ext import commands, ipc
from discord.ext.ipc.server import Server
from discord.ext.ipc.objects import ClientPayload

class MyBot(commands.Bot):
    def __init__(self) -> None:
        intents = discord.Intents.all()

        super().__init__(
            command_prefix="$.",
            intents=intents,
        )

        self.ipc = ipc.Server(self, secret_key="🐼")

    async def setup_hook(self) -> None:
        await self.ipc.start()

    @Server.route()
    async def get_user_data(self, data: ClientPayload) -> Dict:
        user = self.get_user(data.user_id)
        return user._to_minimal_user_json()
```


### Cog example
```python
from typing import Dict
from discord.ext import commands, ipc
from discord.ext.ipc.server import Server
from discord.ext.ipc.errors import IPCError
from discord.ext.ipc.objects import ClientPayload

class Routes(commands.Cog):
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        if not hasattr(bot, "ipc"):
            bot.ipc = ipc.Server(self.bot, secret_key="🐼")
    
    async def cog_load(self) -> None:
        await self.bot.ipc.start()

    async def cog_unload(self) -> None:
        await self.bot.ipc.stop()
        self.bot.ipc = None

    @Server.route()
    async def get_user_data(self, data: ClientPayload) -> Dict:
        user = self.bot.get_user(data.user_id)
        return user._to_minimal_user_json()

async def setup(bot):
    await bot.add_cog(Routes(bot))
```


### Inside your web application
```python
from quart import Quart
from discord.ext.ipc import Client

app = Quart(__name__)
ipc = Client(secret_key="🐼")

@app.route('/')
async def main():
    resp = await ipc.request("get_user_data", user_id=383946213629624322)
    return str(resp.response)

if __name__ == '__main__':
    app.run()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MiroslavRosenov/better-ipc",
    "name": "better-ipc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": "",
    "keywords": "better-ipc,ipc,python,discord.py",
    "author": "DaPandaOfficial",
    "author_email": "miroslav.rosenov39@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ea/c9/69d07324b06cf036dedf97f6db42de264b014f7a17df1d5d7f2d0e8dada8/better-ipc-2.0.1.tar.gz",
    "platform": null,
    "description": "# Better IPC\n\n<a href=\"https://pypi.org/project/better-ipc/\" target=\"_blank\"><img src=\"https://img.shields.io/pypi/v/better-ipc\"></a>\n<img src=\"https://img.shields.io/pypi/pyversions/better-ipc\">\n<img src=\"https://img.shields.io/github/last-commit/MiroslavRosenov/better-ipc\">\n<img src=\"https://img.shields.io/github/license/MiroslavRosenov/better-ipc\">\n<a href=\"https://discord.gg/Rpg7zjFYsh\" target=\"_blank\"><img src=\"https://img.shields.io/discord/875005644594372638?label=discord\"></a>\n\n## High-performance inter-process communication library designed to work with the latest version of [discord.py](https://github.com/Rapptz/discord.py)\n\n<img src=\"https://raw.githubusercontent.com/MiroslavRosenov/better-ipc/main/banner.png\">\n\nThis library is *based* on [discord-ext-ipc](https://github.com/Ext-Creators/discord-ext-ipc), which is no longer maintained.\n\n# Installation\n> ### Stable version\n#### For Linux\n```shell\npython3 -m pip install -U better-ipc\n```\n#### For Windows\n```shell\npy -m pip install -U better-ipc\n```\n\n> ### Development version\n#### For Linux\n```shell\npython3 -m pip install -U git+https://github.com/MiroslavRosenov/better-ipc\n```\n#### For Windows\n```shell\npy -m pip install -U git+https://github.com/MiroslavRosenov/better-ipc\n```\n\n\n# Support\n\n[Support server](https://discord.gg/Rpg7zjFYsh)\n\n[Official documentation](https://docs.better-ipc.xyz)\n\n# Examples\n\n### Client example\n```python\nimport discord\nfrom typing import Dict\nfrom discord.ext import commands, ipc\nfrom discord.ext.ipc.server import Server\nfrom discord.ext.ipc.objects import ClientPayload\n\nclass MyBot(commands.Bot):\n    def __init__(self) -> None:\n        intents = discord.Intents.all()\n\n        super().__init__(\n            command_prefix=\"$.\",\n            intents=intents,\n        )\n\n        self.ipc = ipc.Server(self, secret_key=\"\ud83d\udc3c\")\n\n    async def setup_hook(self) -> None:\n        await self.ipc.start()\n\n    @Server.route()\n    async def get_user_data(self, data: ClientPayload) -> Dict:\n        user = self.get_user(data.user_id)\n        return user._to_minimal_user_json()\n```\n\n\n### Cog example\n```python\nfrom typing import Dict\nfrom discord.ext import commands, ipc\nfrom discord.ext.ipc.server import Server\nfrom discord.ext.ipc.errors import IPCError\nfrom discord.ext.ipc.objects import ClientPayload\n\nclass Routes(commands.Cog):\n    def __init__(self, bot: commands.Bot):\n        self.bot = bot\n        if not hasattr(bot, \"ipc\"):\n            bot.ipc = ipc.Server(self.bot, secret_key=\"\ud83d\udc3c\")\n    \n    async def cog_load(self) -> None:\n        await self.bot.ipc.start()\n\n    async def cog_unload(self) -> None:\n        await self.bot.ipc.stop()\n        self.bot.ipc = None\n\n    @Server.route()\n    async def get_user_data(self, data: ClientPayload) -> Dict:\n        user = self.bot.get_user(data.user_id)\n        return user._to_minimal_user_json()\n\nasync def setup(bot):\n    await bot.add_cog(Routes(bot))\n```\n\n\n### Inside your web application\n```python\nfrom quart import Quart\nfrom discord.ext.ipc import Client\n\napp = Quart(__name__)\nipc = Client(secret_key=\"\ud83d\udc3c\")\n\n@app.route('/')\nasync def main():\n    resp = await ipc.request(\"get_user_data\", user_id=383946213629624322)\n    return str(resp.response)\n\nif __name__ == '__main__':\n    app.run()\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A high-performance inter-process communication library designed to work with the latest version of discord.py",
    "version": "2.0.1",
    "split_keywords": [
        "better-ipc",
        "ipc",
        "python",
        "discord.py"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "463c6a450c8b547c7199afccc8fb3791",
                "sha256": "419e37dc30d9a8b7989a3fbd79c150c704b36b32345db1ffd5a23b759c867703"
            },
            "downloads": -1,
            "filename": "better_ipc-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "463c6a450c8b547c7199afccc8fb3791",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 9739,
            "upload_time": "2022-12-06T12:05:54",
            "upload_time_iso_8601": "2022-12-06T12:05:54.936059Z",
            "url": "https://files.pythonhosted.org/packages/7f/c6/4640c4c70e0b1bfeb3af919994f8967cb2570c948022ae96655f3d58b0ef/better_ipc-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "fc93a9f259b9bfad941c2c4a9280cdab",
                "sha256": "eb7f057c74ac9eae4363da9ef85928805bc1c52c65b024eb445284585c1996e9"
            },
            "downloads": -1,
            "filename": "better-ipc-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fc93a9f259b9bfad941c2c4a9280cdab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 8367,
            "upload_time": "2022-12-06T12:05:56",
            "upload_time_iso_8601": "2022-12-06T12:05:56.794524Z",
            "url": "https://files.pythonhosted.org/packages/ea/c9/69d07324b06cf036dedf97f6db42de264b014f7a17df1d5d7f2d0e8dada8/better-ipc-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-06 12:05:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "MiroslavRosenov",
    "github_project": "better-ipc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "websockets",
            "specs": [
                [
                    ">=",
                    "10.4"
                ]
            ]
        }
    ],
    "lcname": "better-ipc"
}
        
Elapsed time: 0.01751s