Skip to main content

A modern, lightweight and robust task manager with a user-friendly interface and a wide range of features, using the low-level asyncio API and more.

Project description

Jobify
Robust task scheduler for Python.

Supported Python versions Tests Coverage CodeQL Dependency Review PyPI version Downloads License: MIT Telegram


Documentation | Community Extensions

Jobify is a powerful framework for scheduling and managing background jobs in Python. It allows you to easily define and schedule jobs using an intuitive decorator-based API, similar to that of modern web frameworks such as FastAPI.

Unlike many other frameworks that use polling (continuous loops) to schedule tasks, Jobify uses the native timer mechanisms of asyncio for efficient and precise task scheduling.

Key Features

  • Precision: No polling! Uses native asyncio timers for sub-millisecond accuracy and zero idle CPU usage.
  • Scheduling: Run jobs immediately, with a delay, at a specified time, or using Cron expressions (second-level precision supported).
  • Storage: Built-in SQLite ensures scheduled jobs persist through application restarts.
  • Routing: Organize tasks with JobRouter, similar to FastAPI or Aiogram.
  • Inject Context: Inject application state or custom dependencies directly into your tasks.
  • Middlewares: Powerful interceptors for both job execution and the scheduling process.
  • Exception Handlers: Hierarchical error management at the task, router, or global level.
  • Lifespan Support: Manage startup and shutdown events, just like in FastAPI.
  • Job Control: Full control over jobs — wait for completion, cancel tasks, or check results with ease.
  • Concurrency: Supports asyncio, ThreadPoolExecutor, and ProcessPoolExecutor for efficient task handling.
  • Many different adapters to the database.
  • Distributed task queue. Soon.
  • Many different serializers. Soon.

Installation

Install Jobify from PyPI:

pip install jobify

Quick Start

Here is an example of how to define and schedule a task:

import asyncio
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo

from jobify import Jobify

UTC = ZoneInfo("UTC")

# 1. Initialize Jobify
app = Jobify(tz=UTC)


@app.task(cron="* * * * * * *")  # Runs every second
async def my_cron() -> None:
    print("Hello! cron running every second")


@app.task
def my_job(name: str) -> None:
    now = datetime.now(tz=UTC)
    print(f"Hello, {name}! job running at: {now!r}")


async def main() -> None:
    # 2. Run the Jobify application context
    async with app:
        # Run immediately in the background.
        job = await my_job.push("Alex")

        # Schedule a one-time job at a specific time.
        run_next_day = datetime.now(tz=UTC) + timedelta(days=1)
        job_at = await my_job.schedule("Connor").at(run_next_day)

        # Schedule a one-time job after a delay.
        job_delay = await my_job.schedule("Sara").delay(seconds=20)

        # Start a dynamic cron job.
        job_cron = await my_cron.schedule().cron(
            "* * * * *",
            job_id="dynamic_cron_id",
        )

        # Wait for specific jobs to complete
        await job_delay.wait()

        # You can also use `await app.wait_all()` to wait for all currently
        # running jobs. Note that infinite cron jobs will block this indefinitely.
        # await app.wait_all()


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

License

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

Project details


Download files

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

Source Distribution

jobify-0.10.1.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

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

jobify-0.10.1-py3-none-any.whl (51.0 kB view details)

Uploaded Python 3

File details

Details for the file jobify-0.10.1.tar.gz.

File metadata

  • Download URL: jobify-0.10.1.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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 jobify-0.10.1.tar.gz
Algorithm Hash digest
SHA256 393f3bfad0c253d4ae48adca0e04dd8af9a9f350fb9f7b63aa15294cfed397de
MD5 14029102e5e1129ee13e3eb9d6342ae8
BLAKE2b-256 e4ed7d5b12cbf8ad150b1d4ce6ea29e23e2cfcf4848e26c1ac007c2605f8e528

See more details on using hashes here.

File details

Details for the file jobify-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: jobify-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 51.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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 jobify-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0e2b5f5198f96094d4bb104a9b39bcc8f186c8c86f22e6b85a1fd8aa34eadfa
MD5 750394c6b91aa491605d19f6015fcd19
BLAKE2b-256 ee849b6a9ece1b87cfab9b5d74a546e238863f07989fb978c03936d1492d67ea

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