Skip to main content

Advanced scheduling framework

Project description

Rocketry

The engine to power your Python apps

Test Test coverage Package version Supported Python versions


What is it?

Rocketry is a modern scheduling framework for Python applications. It is simple, clean and extensive. It is the automation engine that sets your Python programs alive.

The library is minimal on the surface but large and highly customizable underneath. The syntax very clean:

from rocketry import Rocketry

app = Rocketry()

@app.task('daily')
def do_daily():
    ...

if __name__ == '__main__':
    app.run()
Dislike the string syntax?

There is also a condition API which is almost identical to the string syntax:

from rocketry import Rocketry
from rocketry.conds import daily

app = Rocketry()

@app.task(daily)
def do_daily():
    ...

if __name__ == '__main__':
    app.run()

Compared to alternatives, Rocketry has the most elegant syntax and is the most productive. It offers more features than Crontab or APScheduler but is much easier to work with than Airflow. It does not make assumptions of your project.

Core functionalities:

  • Powerful scheduling syntax
  • A lot of built-in scheduling options
  • Task parallelization
  • Task parametrization
  • Task pipelining
  • Modifiable session also in runtime
  • Async support

Links:

Installation

Install Rocketry from PyPI:

pip install rocketry

More Examples

Here are some more examples of what it can do.

Scheduling:

@app.task("every 10 seconds")
def do_continuously():
    ...

@app.task("daily after 07:00")
def do_daily_after_seven():
    ...

@app.task("hourly & time of day between 22:00 and 06:00")
def do_hourly_at_night():
    ...

@app.task("(weekly on Monday | weekly on Saturday) & time of day after 10:00")
def do_twice_a_week_after_ten():
    ...
Same with condition API
from rocketry.conds import every, daily, hourly, time_of_day, weekly

@app.task(every("10 seconds"))
def do_continuously():
    ...

@app.task(daily.after("07:00"))
def do_daily_after_seven():
    ...

@app.task(hourly & time_of_day.between("22:00", "06:00"))
def do_hourly_at_night():
    ...

@app.task((weekly.on("Monday") | weekly.on("Saturday")) & time_of_day.after("10:00"))
def do_twice_a_week_after_ten():
    ...

Pipelining tasks:

from rocketry.args import Return

@app.task("daily after 07:00")
def do_first():
    ...
    return 'Hello World'

@app.task("after task 'do_first'")
def do_second(arg=Return('do_first')):
    # arg contains the value of the task do_first's return
    ...
    return 'Hello Python'
Same with condition API
from rocketry.conds import daily, after_success
from rocketry.args import Return

@app.task(daily.after("07:00"))
def do_first():
    ...
    return 'Hello World'

@app.task(after_success(do_first))
def do_second(arg=Return(do_first)):
    # arg contains the value of the task do_first's return
    ...
    return 'Hello Python'

Parallelizing tasks:

@app.task("daily", execution="main")
def do_unparallel():
    ...

@app.task("daily", execution="async")
async def do_async():
    ...

@app.task("daily", execution="thread")
def do_on_separate_thread():
    ...

@app.task("daily", execution="process")
def do_on_separate_process():
    ...

Interested?

Read more from the documentation.

About Library

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

rocketry-2.2.0.tar.gz (140.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rocketry-2.2.0-py3-none-any.whl (177.6 kB view details)

Uploaded Python 3

File details

Details for the file rocketry-2.2.0.tar.gz.

File metadata

  • Download URL: rocketry-2.2.0.tar.gz
  • Upload date:
  • Size: 140.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for rocketry-2.2.0.tar.gz
Algorithm Hash digest
SHA256 832722ec6d063e03f68920f162f322ffdce0e27a963c447f18ff7802496bc45b
MD5 608c5276da5bb94de5ec9c99db249509
BLAKE2b-256 cfc68cf416c92a57d5c6f57145509194424458393ffce2542eee47ad2df77112

See more details on using hashes here.

File details

Details for the file rocketry-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: rocketry-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 177.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for rocketry-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90b306ede046fa5c82ab30f8d9e5ec89be6ea7aa53a452a7df3e0ce30c3695b5
MD5 838398a9959800ea2d244ae0fd345114
BLAKE2b-256 042f9e681d27144888385c64ce675ae4b2aea0314f973950ac4e0700bd16c985

See more details on using hashes here.

Supported by

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