Automate scripts with zero setup. Run Python tasks anytime, anywhere.
Project description
AutoCron ⏰
Schedule Python tasks with one line of code. Works everywhere.
AutoCron makes task scheduling painless—no cron syntax, no platform-specific setup. Just Python.
🚀 Quick Start
Install:
pip install autocron
Schedule a task:
from autocron import schedule
@schedule(every='5m')
def my_task():
print("Running every 5 minutes!")
That's it. AutoCron handles the rest.
✨ Why AutoCron?
| Feature | AutoCron | cron/Task Scheduler |
|---|---|---|
| 🌍 Cross-platform | ✅ Windows, Linux, macOS | ❌ Platform-specific |
| 💻 Pure Python | ✅ No system config | ❌ Requires system setup |
| 🔄 Retry logic | ✅ Built-in | ❌ Manual implementation |
| 📊 Logging | ✅ Automatic | ❌ Manual setup |
| 🔔 Notifications | ✅ Desktop + Email | ❌ Not included |
| ⚡ Type hints | ✅ Fully typed | N/A |
📦 Installation
Basic:
pip install autocron
With notifications:
pip install autocron[notifications]
From source:
git clone https://github.com/mdshoaibuddinchanda/autocron.git
cd autocron
pip install -e .
💡 Examples
Simple Decorator
from autocron import schedule
@schedule(every='30m')
def fetch_data():
# Runs every 30 minutes
print("Fetching data...")
@schedule(cron='0 9 * * *') # Every day at 9 AM
def daily_report():
print("Generating report...")
Scheduler Class
from autocron import AutoCron
scheduler = AutoCron()
scheduler.add_task(
name="backup",
func=backup_database,
every='1h',
retries=3,
notify='desktop'
)
scheduler.start()
With Retry & Timeout
@schedule(every='10m', retries=3, timeout=60)
def api_call():
# Retries up to 3 times, max 60 seconds
response = requests.get('https://api.example.com/data')
return response.json()
Email Notifications
scheduler.add_task(
name="critical_task",
func=process_payments,
cron='0 */4 * * *', # Every 4 hours
notify='email',
email_config={
'smtp_server': 'smtp.gmail.com',
'smtp_port': 587,
'from_email': 'YOUR_EMAIL@gmail.com',
'to_email': 'ADMIN_EMAIL@gmail.com',
'password': 'YOUR_APP_PASSWORD_HERE'
}
)
📖 Time Formats
Intervals:
'30s'→ Every 30 seconds'5m'→ Every 5 minutes'2h'→ Every 2 hours'1d'→ Every day
Cron expressions:
'0 9 * * *'→ Daily at 9 AM'*/15 * * * *'→ Every 15 minutes'0 0 * * 0'→ Sundays at midnight'0 12 * * 1-5'→ Weekdays at noon
🛠️ CLI
# Schedule from command line
autocron schedule script.py --every 5m --retries 3
# List tasks
autocron list
# View logs
autocron logs task_name
🎯 Use Cases
- Data pipelines – ETL jobs, backups, syncs
- Web scraping – Periodic data collection
- Monitoring – Health checks, API status
- Reports – Automated daily/weekly reports
- Maintenance – Log cleanup, cache clearing
📚 Documentation
📖 New to AutoCron? Check out our Complete Guide for detailed examples, production setup, and platform-specific instructions!
- Complete Guide – Full manual with all examples
- Quick Start – Get started in 5 minutes
- API Reference – Complete API docs
- Examples – Real-world use cases
- FAQ – Common questions
🧪 Testing
AutoCron is tested across 12 combinations (3 OS × 4 Python versions):
pytest # Run all tests
pytest --cov=autocron # With coverage
pytest -m linux # Platform-specific
Test matrix:
- ✅ Windows, Linux, macOS
- ✅ Python 3.10, 3.11, 3.12, 3.13, 3.14
- ✅ 82/84 tests passing (69% coverage)
🤝 Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
📝 License
MIT License – see LICENSE for details.
🔗 Links
- PyPI: https://pypi.org/project/autocron/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Changelog: CHANGELOG.md
Made with ❤️ by mdshoaibuddinchanda
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autocron_scheduler-1.0.1.tar.gz.
File metadata
- Download URL: autocron_scheduler-1.0.1.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fff5c75cdd0eb3a40ad16fd087ca5590a9d0ba1b077dabc6402bb0c0409d0817
|
|
| MD5 |
2448b2e5b47c2326dab60fe8b577bed2
|
|
| BLAKE2b-256 |
594092100b9213566802a324abd223976a66f328dd85db507dbce02c0eadf2a8
|
File details
Details for the file autocron_scheduler-1.0.1-py3-none-any.whl.
File metadata
- Download URL: autocron_scheduler-1.0.1-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b81c7272b13631c28ccd488aae907dbb64ce4679da9bebbc2044559c1b982a63
|
|
| MD5 |
1c35a41c395e4c2c5fbc379fffeeff0a
|
|
| BLAKE2b-256 |
a06a774b7f220b743c6f77011ff157a5bbe779c25a8208370d5f3eb8b5c2fdb0
|