Skip to main content

commandkit

a standalone library to bring discord.py developer experience to your python applications, focus on building your logic rather then an event manager or command manager

Features

  • Familiar Decorator API – Leverages the intuitive discord.py pattern for registering commands and events.
  • Automatic Type Conversion – Uses Python type hints to automatically convert input strings into integers, floats, or custom objects.
  • Asynchronous by Design – Built from the ground up for asyncio, allowing command and event handlers to run concurrently within your existing event loop.
  • Zero Bloat – A focused codebase with zero dependencies.

Installation

been tested in python 3.10

Run the following to install:

pip install commandkit

or

python -m pip install commandkit

if that didn't work, try replacing pip with pip3.

need help? or have bugs to report, let me know in here

Quick Examples

import asyncio
from commandkit import CommandLine, Greedy

cmder = CommandLine(prefix="!")

@cmder.command()
def add(a: int, b: int):
	"""Adds two numbers."""
	return a + b

@cmder.command()
async def announce(title: str, *, message: str):
	"""Capture the rest of the string as a single argument."""
	await asyncio.sleep(0.1)
	return f"[{title}] {message}"

async def main():
	# Sync command call
	res = await cmder.process_command("!add 10 20")
	print(res) # 30

	# Rest capture
	res = await cmder.process_command('!announce "System Alert" This is a test message.')
	print(res) # [System Alert] This is a test message.

if __name__ == "__main__":
	asyncio.run(main())

Event Management

CommandKit includes a standalone EventManager for dispatching async events.

from commandkit import EventManager
import asyncio

em = EventManager()

@em.event
async def on_message(arg):
	print(f"Event received: {arg}")

async def run_events():
	# dispatch("test") will trigger all "on_message" events
	await em.dispatch("message", "Hello World!")

asyncio.run(run_events())

Documentation

you can check commandkit docs here

Contributing

We value technical contributions and bug reports.

  • Issues: Open a ticket for bugs or feature requests.
  • PRs: Pull requests are welcome. Please ensure code follows PEP 8 standards.

License

CommandKit is distributed under the MIT License.

Metadata

Release files for commandkit 0.3.1

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

Source distribution (sdist)

Source distribution for commandkit 0.3.1
File Size Uploaded Provenance Actions
commandkit-0.3.1.tar.gz 12.3 kB Without provenance Details for commandkit-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for commandkit 0.3.1
File Interpreter ABI Platform Actions
commandkit-0.3.1-py3-none-any.whl Python 3 none any Details for commandkit-0.3.1-py3-none-any.whl

Total release size: 24.3 kB

Release files / commandkit-0.3.1.tar.gz

Download URL commandkit-0.3.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
86bf780692e6d8de87172bd847469581c78d345d0ad76074d95dc094bf469bd0
BLAKE2b-256 checksum
How to use checksums
b57447b6d8e75b996dbecd4787f2f8daa2054dae0c8facb24bee29156bee89ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / commandkit-0.3.1-py3-none-any.whl

Download URL commandkit-0.3.1-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
731d802b298aa6913a723a8c233dd185158c954b2870913ba58a4aeab2ee54ad
BLAKE2b-256 checksum
How to use checksums
09e95f6e15abbbb3949ac7c4acf9b9246574fde74dc86ab4169a044bf99b44ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for commandkit 0.3.1

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.

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