Skip to main content

Sheppy

PyPI version CI Python versions

Sheppy is an async-native task queue for Python. Decorate a function with @task, add it to a Queue, and a worker process executes it. Arguments are validated with Pydantic, tasks are stored in Redis (and soon Postgres), and workers wait on blocking reads instead of polling.

Install

pip install sheppy

Example

import asyncio

from sheppy import Queue, task


@task
async def send_email(to: str, subject: str) -> str:
    return f"sent '{subject}' to {to}"


async def main() -> None:
    queue = Queue("memory://")  # use "redis://localhost:6379" in production

    t = send_email("alice@example.com", "Welcome!")  # returns a Task model, nothing runs yet
    await queue.add(t)

    done = await queue.wait_for(t)
    print(done.result)


if __name__ == "__main__":
    asyncio.run(main())
$ python example.py
sent 'Welcome!' to alice@example.com

The memory:// backend executes tasks in-process, so this runs with no external services. Against Redis the application code is identical, but a separate worker process executes the tasks:

docker run -d -p 6379:6379 redis:7   # task storage
python example.py                    # enqueues the task and waits for the result
sheppy work                          # run in a second terminal: picks up and executes it

Scale out by starting more workers: every sheppy work process adds capacity.

Features

  • Scheduling and cron: queue.schedule(t, at=timedelta(minutes=30)) or an absolute datetime, queue.add_cron(t, "0 9 * * *") for recurring tasks
  • Retries: @task(retry=3, retry_delay=[1, 10, 60]) waits 1s, then 10s, then 60s between attempts. Timeouts and worker crashes can trigger retries too
  • Rate limiting: @task(rate_limit={"max_rate": 2, "rate_period": 5}) delays tasks past the limit (sliding or fixed window) instead of dropping them
  • Pydantic validation: arguments are checked when you call the task function, before anything is queued. Results are validated against the return annotation
  • TestQueue runs tasks synchronously in unit tests without a separate worker or redis
  • FastAPI integration: Depends injection inside task functions and a monitoring ApiRouter

Requirements

  • Python 3.10+
  • Redis 7.4+

Development

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

docker compose -f docker-compose.test.yml up -d
uv run pytest tests/
uv run mypy --strict src/sheppy/
uv run ruff check src/ tests/

License

MIT. See LICENSE.

Metadata

Release files for sheppy 0.0.8

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

Source distribution (sdist)

Source distribution for sheppy 0.0.8
File Size Uploaded Provenance Actions
sheppy-0.0.8.tar.gz 65.6 kB Without provenance Details for sheppy-0.0.8.tar.gz

Built distribution (wheel)

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

Total release size: 155.3 kB

Release files / sheppy-0.0.8.tar.gz

Download URL sheppy-0.0.8.tar.gz
Size 65.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7c4b9d3da987c5afa7b5cb3eb6d23c8331b0f4ae07c92b6d9471732d90210739
BLAKE2b-256 checksum
How to use checksums
620f3ae09db9ca54025f5d65b4982643e650e23844bad15d8843c8295714896e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sheppy-0.0.8-py3-none-any.whl

Download URL sheppy-0.0.8-py3-none-any.whl
Size 89.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f672d1a9906a91f55ddbe8b058d8ab7a0f481b0fe33fa06d4c66ca1823ea6c8
BLAKE2b-256 checksum
How to use checksums
84b65bfb718fd59d0919c7cb6b409f162d1ff021cf4fc796191bb1a23836a6f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for sheppy 0.0.8

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