All Projects → kipe → Pycron

kipe / Pycron

Licence: mit
Simple cron-like parser for Python, which determines if current datetime matches conditions

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Pycron

Pg cron
Run periodic jobs in PostgreSQL
Stars: ✭ 1,002 (+1025.84%)
Mutual labels:  cron
F3 Cron
Job scheduling for the PHP Fat-Free Framework
Stars: ✭ 65 (-26.97%)
Mutual labels:  cron
Egg Schedule
Schedule plugin for egg
Stars: ✭ 76 (-14.61%)
Mutual labels:  cron
Vue Cron Generator
Cron Generator Implemented by Vue.js and Element-ui(基于Vue&Element-UI构建的在线Cron表达式生成器)
Stars: ✭ 48 (-46.07%)
Mutual labels:  cron
Go Todo
微信小程序 todo后端,采用GoFrame框架搭建,包含微信认证、token管理、发送微信模板消息等
Stars: ✭ 60 (-32.58%)
Mutual labels:  cron
Wp Missed Schedule
Find only missed schedule posts, every 15 minutes, and republish correctly 10 items each session. The Original plugin (only this) no longer available on WordPress.org for explicit author request! Compatible with WP 2.1+ to 4.9+ and 5.0-beta3 (100.000+ installs 300.000+ downloads 2016-04-13) Please: do not install unauthorized malware cloned forked!
Stars: ✭ 69 (-22.47%)
Mutual labels:  cron
Cronicle
A simple, distributed task scheduler and runner with a web based UI.
Stars: ✭ 979 (+1000%)
Mutual labels:  cron
Gcalcron
Schedule shell commands execution through Google Calendar
Stars: ✭ 81 (-8.99%)
Mutual labels:  cron
Crontab
Parse Cron Expressions, Compose Cron Expression Strings and Caluclate Execution Dates.
Stars: ✭ 62 (-30.34%)
Mutual labels:  cron
Fleets
Automatically delete tweets, retweets, and favorites.
Stars: ✭ 75 (-15.73%)
Mutual labels:  cron
Tiktok
Python web visualize build on the awesome web framework sanic
Stars: ✭ 55 (-38.2%)
Mutual labels:  cron
Go Crond
⏰ Cron daemon written in golang (for eg. usage in docker images)
Stars: ✭ 59 (-33.71%)
Mutual labels:  cron
Phalcon Cron
Cron component for Phalcon.
Stars: ✭ 73 (-17.98%)
Mutual labels:  cron
Crontab
⏰ Cron expression generator
Stars: ✭ 44 (-50.56%)
Mutual labels:  cron
Sidekiq Scheduler
Lightweight job scheduler extension for Sidekiq
Stars: ✭ 1,198 (+1246.07%)
Mutual labels:  cron
Daily Hero
The bot that sends daily closed issues digest to our team
Stars: ✭ 38 (-57.3%)
Mutual labels:  cron
Ppgo job
PPGo_Job是一款可视化的、多人多权限的、一任务多机执行的定时任务管理系统,采用golang开发,安装方便,资源消耗少,支持大并发,可同时管理多台服务器上的定时任务。
Stars: ✭ 1,152 (+1194.38%)
Mutual labels:  cron
Laravel Totem
Manage Your Laravel Schedule From A Web Dashboard
Stars: ✭ 1,299 (+1359.55%)
Mutual labels:  cron
Jobber
An alternative to cron, with sophisticated status-reporting and error-handling
Stars: ✭ 1,217 (+1267.42%)
Mutual labels:  cron
Cronos Bundle
Easy update your crontab by using @cron annotations in Symfony commands.
Stars: ✭ 73 (-17.98%)
Mutual labels:  cron

pycron

Test Status Coverage Status

Simple cron-like parser for Python, which determines if current datetime matches conditions.

Installation

pip install pycron

Usage

import pycron
pycron.is_now('*/5 * * * *')  # True every 5 minutes
pycron.is_now('0 * * * *')    # True every hour, on minute 0

Help

The formats currently supported are

  • */5 (for "every X" function),
  • 4-10 (for time ranges),
  • 6,8,23 (for a list of values),
  • * (for wildcard),
  • and of course a single number.

The module includes is_now(s, dt=None), where s is the cron-style string and dt is the datetime to use (defaults to current datetime, if not set). The function returns True, if dt matches the format.

It also includes has_been(s, since, dt=None), where s is the cron-style string, since is a datetime in the past and dt is the datetime to use (defaults to current datetime, if not set). The function returns True, if dt would have matched the format at some point during the period. This behaves much like like anacron and is useful for applications which do not run continuously.

All functions are compatible with both timezone aware and naive datetimes.

There are couple of helpers available, mainly for use with Django. They give out list of tuples, as required by Django field choices.

The available helpers are

  • pycron.MINUTE_CHOICES,
  • pycron.HOUR_CHOICES,
  • pycron.DOM_CHOICES, for day of month
  • pycron.MONTH_CHOICES, for month names
  • pycron.DOW_CHOICES, for day names

Support for alternative datetime -libraries

Currently supported "alternative" datetime libraries are:

Notes

This was done, as I personally needed something like this to implement proper timers for my Django-project and every available library felt too complicated for my use-case. Also, this was a good coding exercise...

As the Django -helper choices are quite limited, I've expanded them in my own project by adding values like ('*/5', 'every 5 minutes'), ('1-5', 'on weekdays'), and ('0,6', 'on weekends'). I haven't included them in the code, as every use-case is different, this was just to give an idea on how to use this ;)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].