Skip to main content

A modern, fast, and easy to use task queue system for async Python

Project description

Sheppy 🐕

Documentation: https://docs.sheppy.org


What is Sheppy?

Sheppy is an async-native task queue designed to be simple enough to understand completely, yet powerful enough to handle millions of tasks in production. Built on asyncio from the ground up and uses blocking waits instead of polling. Sheppy scales from the smallest deployments to large distributed systems by simply launching more worker processes.

Core Principles

  • Async Native: Built on asyncio from the ground up
  • Simplicity: Two main concepts - @task decorator and Queue
  • Low Latency: Blocking reads instead of polling
  • Type Safety: Full Pydantic integration for validation and serialization
  • Easy Scaling: Just run more workers with sheppy work
  • No Magic: Clear and understandable implementation

TL;DR Quick Start

This is all you need to know:

import asyncio
from datetime import datetime, timedelta
from sheppy import Queue, task, RedisBackend

queue = Queue(RedisBackend("redis://127.0.0.1:6379"))

@task
async def say_hello(to: str) -> str:
    s = f"Hello, {to}!"
    print(s)
    return s

async def main():
    t1 = say_hello("World")
    await queue.add(t1)
    await queue.add(say_hello("Moon"))
    await queue.schedule(say_hello("Patient Person"), at=timedelta(seconds=10))  # runs in 10 seconds from now
    await queue.schedule(say_hello("New Year"), at=datetime.fromisoformat("2026-01-01 00:00:00 +00:00"))

    # await the task completion
    updated_task = await queue.wait_for(t1)

    if updated_task.error:
        print(f"Task failed with error: {updated_task.error}")
    elif updated_task.completed:
        print(f"Task succeed with result: {updated_task.result}")
        assert updated_task.result == "Hello, World!"
    else:
        # note: this won't happen because wait_for doesn't return pending tasks
        print("Task is still pending!")

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

Run it:

# run the app:
python examples/tldr.py  # nothing will happen because worker isn't running

# in another terminal, you can list queued tasks:
sheppy task list  # (shows 2 pending and 2 scheduled tasks)

# run worker process to process the tasks
sheppy work  # (you should see the tasks to get processed, and the app should finish!)

For more details, see the Getting Started Guide.

Requirements

  • Python 3.10+
  • Redis 8+

Developing

git clone https://github.com/malvex/sheppy.git
cd sheppy
uv sync --group dev

pytest -v tests/ --tb=short
mypy src/
ruff check src/

License

This project is licensed under the terms of the MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sheppy-0.0.3.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sheppy-0.0.3-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file sheppy-0.0.3.tar.gz.

File metadata

  • Download URL: sheppy-0.0.3.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sheppy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2a759f40cc10310bcd2e9b433dc6d24ca585cc52424704587c9bcb5b0d9c856f
MD5 e2585f5e03c1771544c7b7dbf2ddfe7a
BLAKE2b-256 0ffbce142cebc2417747decf323ac60dc30d093dbf087a7e380c8f96498722ef

See more details on using hashes here.

File details

Details for the file sheppy-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: sheppy-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sheppy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 40b02e1f6578543255d5222764c5aa57a120d74e7611e75b9424ebd92a635931
MD5 c74b7bb858920869ff014ee96a8ad801
BLAKE2b-256 73b7bec867c65a451eb78f42ba1b802a41f41494410ae9f2002b081de5672f6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page