Skip to main content

Better Cluster

A high-performance inter-process communication library designed to handle communication between multiple bots/web applications

This library is made to handle mulltiple discord clients. If you want something simpler or have only one client, check out better-ipc

Installation

Stable version

For Linux

python3 -m pip install -U better-cluster

For Windows

py -m pip install -U better-cluster

Development version

For Linux

python3 -m pip install -U git+https://github.com/MiroslavRosenov/better-cluster

For Windows

py -m pip install -U git+https://github.com/MiroslavRosenov/better-cluster

Support

You can join the support server here

Examples

Example of a cluster

import asyncio
from discord.ext.cluster import Cluster

if __name__ == "__main__":
    cluster = Cluster()
    asyncio.run(cluster.start())

Example of a shard

import asyncio
import discord

from discord.ext.cluster import Shard, ClientPayload
from discord.ext import commands

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

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

        self.shard = Shard(self, shard_id=1)

    async def setup_hook(self) -> None:
        await self.shard.connect()

    @Shard.route(shard_id=1)
    async def get_user_data(self, data: ClientPayload):
        user = self.get_user(data.user_id)
        return user._to_minimal_user_json()

if __name__ == '__main__':
    bot = MyBot()
    asyncio.run(bot.run(...))

Example of web client

from quart import Quart
from discord.ext import cluster

app = Quart(__name__)
ipc = cluster.Client()

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

if __name__ == '__main__':
    app.run(port=8000, debug=True)

Metadata

Release files for better-cluster 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for better-cluster 1.0.0
File Size Uploaded Provenance Actions
better-cluster-1.0.0.tar.gz 8.4 kB Without provenance Details for better-cluster-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for better-cluster 1.0.0
File Interpreter ABI Platform Actions
better_cluster-1.0.0-py3-none-any.whl Python 3 none any Details for better_cluster-1.0.0-py3-none-any.whl

Total release size: 18.5 kB

Release files / better-cluster-1.0.0.tar.gz

Download URL better-cluster-1.0.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
670ddca9932ab2ced45e9ac19e3d6a5f25222715a7f83e29423f447b2f2ab44e
BLAKE2b-256 checksum
How to use checksums
94785b5291641e2dd4c27eb6855e885c085daefb4e0337d28b652caa9a254b99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release files / better_cluster-1.0.0-py3-none-any.whl

Download URL better_cluster-1.0.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04bdeae67100e8f94bfbf8363b141bb0b592372aaabbc290edb58d64660d74ef
BLAKE2b-256 checksum
How to use checksums
ca9e8743975025a4a9a7513a2e2c4b23a1fad9ac12fe7ef69461c2c492f36430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for better-cluster 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page