Metadata-Version: 2.4
Name: cronify-scheduler
Version: 0.1.0
Summary: Lightweight background task scheduler — no Celery needed
License: MIT
Project-URL: Repository, https://github.com/shahabRDZ/cronify
Keywords: scheduler,cron,background-tasks,asyncio,celery-alternative
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

<h1 align="center">cronify</h1>

<p align="center">
  <strong>Lightweight background task scheduler for Python — no Celery needed</strong>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/python-3.10+-blue?logo=python&logoColor=white" />
  <img src="https://img.shields.io/badge/dependencies-zero-brightgreen" />
  <img src="https://img.shields.io/badge/license-MIT-green" />
</p>

---

## Install

```bash
pip install cronify
```

## Usage

```python
from cronify import Scheduler

scheduler = Scheduler()

@scheduler.every(minutes=5)
async def cleanup_expired_tokens():
    await db.execute("DELETE FROM tokens WHERE expires_at < now()")

@scheduler.every(hours=1, run_immediately=True)
async def sync_exchange_rates():
    rates = await fetch_rates()
    await cache.set("rates", rates)

# Start in your FastAPI app:
@app.on_event("startup")
async def startup():
    await scheduler.start()
```

## Features

- `@scheduler.every(seconds=30)` — decorator syntax
- Async and sync functions supported
- Error resilient — one failing job doesn't stop others
- No Redis, no Celery, no external broker
- Pure asyncio — works everywhere Python runs
- `run_immediately=True` for instant first execution
- Zero dependencies

## API

```python
scheduler.every(seconds=30)            # every 30 seconds
scheduler.every(minutes=5)             # every 5 minutes
scheduler.every(hours=1)               # every hour
scheduler.every(hours=1, minutes=30)   # every 1.5 hours
scheduler.every(seconds=10, run_immediately=True)  # run now, then every 10s

await scheduler.start()   # start all jobs
await scheduler.stop()    # cancel all jobs
scheduler.jobs             # list registered jobs
```

## License

MIT
