Metadata-Version: 2.4
Name: schedr
Version: 1.1.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Requires-Dist: schedr[http,mongo,ssh,postgres,mysql] ; extra == 'connections'
Requires-Dist: httpx>=0.28,<1 ; extra == 'http'
Requires-Dist: pymongo>=4.10,<5 ; extra == 'mongo'
Requires-Dist: pymysql[rsa]>=1.1,<2 ; extra == 'mysql'
Requires-Dist: psycopg[binary]>=3.2,<4 ; extra == 'postgres'
Requires-Dist: pydantic>=2.11,<3 ; extra == 'pydantic'
Requires-Dist: paramiko>=5.0,<6 ; extra == 'ssh'
Requires-Dist: uvloop>=0.23,<1 ; extra == 'uvloop'
Provides-Extra: connections
Provides-Extra: http
Provides-Extra: mongo
Provides-Extra: mysql
Provides-Extra: postgres
Provides-Extra: pydantic
Provides-Extra: ssh
Provides-Extra: uvloop
License-File: LICENSE
License-File: LICENSE-THIRD-PARTY
Summary: schedr scheduler: a Python DAG API plus the schedr binary.
Author-email: Piotr Tutak <p.tutak@outlook.com>
License-Expression: MIT
Requires-Python: >=3.14
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/ptutak/schedr/blob/main/CHANGELOG.md
Project-URL: Documentation, https://ptutak.github.io/schedr/
Project-URL: Issues, https://github.com/ptutak/schedr/issues
Project-URL: Repository, https://github.com/ptutak/schedr

# schedr

A job scheduler written in Rust that runs Python DAGs, Python scripts and shell commands: a
native Python API for DAGs, one binary for the scheduler, its web UI and its workers, SQLite on
a laptop and Postgres in production.

**Documentation:** https://ptutak.github.io/schedr/ ·
**Source:** https://github.com/ptutak/schedr

## Install

Python 3.14 or newer, in a virtual environment of a project directory:

```sh
mkdir my-schedr && cd my-schedr
python3.14 -m venv .venv
.venv/bin/pip install schedr          # add [pydantic] for Pydantic models
```

The wheel carries the `schedr` binary (Linux x86_64 and aarch64, macOS arm64): nothing to
compile.

## Run it

Put a DAG in `dags/sync.py`:

```python
from datetime import timedelta

from schedr import CommandOperator, Cron, Dag, StepDefaults, dag_ctx, task

with Dag(
    "sync_customers",
    description="Syncs customers daily at 03:00 Warsaw time: extract, load, notify.",
    trigger=Cron("0 3 * * *", tz="Europe/Warsaw", start="2026-01-01"),
    defaults=StepDefaults(retries=2, retry_delay=timedelta(minutes=5)),
):

    @task
    def extract() -> list[dict[str, str]]:
        return [{"id": "1", "name": "Ada"}, {"id": "2", "name": "Grace"}]

    @task(timeout=timedelta(minutes=10))
    def load(rows: list[dict[str, str]]) -> int:
        print(f"loading {len(rows)} customers")
        return len(rows)

    rows = extract()  # Output[list[dict[str, str]]]
    count = load(rows)  # load depends on extract (data flow)

    CommandOperator(  # depends on load: its command uses `count`
        "notify",
        command=["echo", t"synced {count} customers for {dag_ctx.run.planned_for}"],
    )
```

Start schedr (the scheduler, the web UI and one worker, in one process, on SQLite), watching
the `dags` folder:

```sh
.venv/bin/schedr standalone --migrate --dag-path dags
```

The web UI is at http://127.0.0.1:8080/. In a second terminal:

```sh
.venv/bin/schedr dags list                      # sync_customers, paused
.venv/bin/schedr runs trigger sync_customers    # a manual run
.venv/bin/schedr runs list sync_customers
.venv/bin/schedr dags unpause sync_customers    # daily at 03:00 from now on
```

Ctrl-C stops it; the next start keeps the DAGs, runs and logs
(`~/.local/share/schedr`).

## Next

- [Getting started](https://ptutak.github.io/schedr/01-start/index.html): these steps, explained
- [Writing DAGs](https://ptutak.github.io/schedr/02-dags/index.html): tasks, data flow,
  schedules, retries; `schedr dags check` and `schedr dags test` without a server
- [How schedr works](https://ptutak.github.io/schedr/03-guide/index.html): the life of a run,
  the master and workers, failures, the web UI and its Metrics page
- [Deployment](https://ptutak.github.io/schedr/03-guide/10-deployment.html): the images and
  the Helm chart, Postgres, separate roles, a standby master
- [Changelog](https://github.com/ptutak/schedr/blob/main/CHANGELOG.md)

