Skip to main content

Lavos: A Pythonic Cron Expression Serializer with Fluent Syntax.

Project description

Lavos: A Pythonic Cron Expression Serializer with Fluent Syntax

Lavos is an innovative Python library that simplifies working with cron expressions. It replaces the cryptic syntax of traditional cron expressions with a fluent, human-readable API. Lavos allows you to define cron schedules for your tasks intuitively, making schedule management in Python applications easier than ever.

Features

  • Fluent Syntax: Enjoy a fluent and expressive syntax for defining cron schedules, making your code more readable and maintainable.
  • AWS Cron Support: Compatible with traditional Unix and AWS cron expressions, providing versatility for different environments.
  • Syntax Sugars: Includes convenient syntax sugars for common scheduling patterns, allowing for more concise code.

Installation

Install Lavos using pip:

pip install lavos

Usage

Lavos offers a range of functionalities for scheduling tasks. Below are examples demonstrating its versatility:

Basic Usage

from lavos import Lavos, MON, JAN, FEB, MAR, WEEKDAYS

cron = Lavos()
  • Every 5 Minutes:
    # Cron: */5 * * * *
    cron.every(5).minutes
    
  • Every Hour:
    # Cron: 0 * * * *
    cron.every(1).hours
    
  • Daily at Specific Time:
    # Cron: 0 14 * * *
    cron.at("14:00").daily
    
  • Specific Weekday at Time:
    # Cron: 0 12 * * 5
    cron.at("12:00").on(THU)
    
  • First Day of Every Month:
    # Cron: 0 0 1 * *
    cron.on(1).monthly
    
  • Specific Days of Specific Months:
    # Cron: 0 0 15 1,2 *
    cron.on(15).of(JAN, FEB)
    
  • Every Weekday at Multiple Times:
    # Cron: 0 9,17 * * 1-5
    cron.at("09:00", "17:00").on(WEEKDAYS)
    
  • First Day of Spring:
    # Cron: 0 0 20 3 *
    cron.on(20).of(MAR).annually()
    

Using AWS Format

You can also create schedules using the AWS cron format:

cron = Lavos(format="aws")

# Every 5 minutes in AWS format
# */5 * * * ? *
cron.every(5).minutes

# Every weekday at 09:00 in AWS format
# 0 9 * * ? *
cron.at("09:00").on(WEEKDAYS)

Advanced Features

Contributing

We welcome contributions to Lavos! Whether it's adding new features, improving documentation, or fixing bugs, your input is valuable.

License

Lavos is released under MIT. See the LICENSE file for more details.

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

lavos-0.1.0.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

lavos-0.1.0-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page