Skip to main content

Rocketry

The engine to power your Python apps

Test Test coverage Package version Supported Python versions


What is it?

Rocketry is a modern statement-based scheduling framework for Python. It is simple, clean and extensive. It is suitable for small and big projects.

This is how it looks like:

from rocketry import Rocketry
from rocketry.conds import daily

app = Rocketry()

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

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

Core functionalities:

  • Powerful scheduling
  • Concurrency (async, threading, multiprocess)
  • Parametrization
  • Task pipelining
  • Modifiable session also in runtime
  • Async support

Links:

Why Rocketry?

Unlike the alternatives, Rocketry's scheduler is statement-based. Rocketry natively supports the same scheduling strategies as the other options, including cron and task pipelining, but it can also be arbitrarily extended using custom scheduling statements.

Here is an example of custom conditions:

from rocketry.conds import daily, time_of_week
from pathlib import Path

@app.cond()
def file_exists(file):
    return Path(file).exists()

@app.task(daily.after("08:00") & file_exists("myfile.csv"))
def do_work():
    ...

Rocketry is suitable for quick automation projects and for larger scale applications. It does not make assumptions of your project structure.

Installation

Install Rocketry from PyPI:

pip install rocketry

More Examples

Here are some more examples of what it can do.

Scheduling:

from rocketry.conds import every
from rocketry.conds import hourly, daily, weekly, 
from rocketry.conds import time_of_day
from rocketry.conds import cron

@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("Mon") | weekly.on("Sat")) & time_of_day.after("10:00"))
def do_twice_a_week_after_ten():
    ...

@app.task(cron("* 2 * * *"))
def do_based_on_cron():
    ...

Pipelining tasks:

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:

from rocketry.conds import daily

@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

Metadata

Release files for rocketry 2.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rocketry 2.5.1
File Size Uploaded
rocketry-2.5.1.tar.gz 327.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rocketry 2.5.1
File Interpreter ABI Platform
rocketry-2.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 544.3 kB

Release files / rocketry-2.5.1.tar.gz

Download URL rocketry-2.5.1.tar.gz
Size 327.5 kB
Tags Source
SHA-256 checksum
How to use checksums
11d1fb3d2856c5b2727bb4814c4f2bfbd2803067eebeac872d34a4c7a6756825
BLAKE2b-256 checksum
How to use checksums
b1acd66cd3d76d4ef6f4a72311e6c8968673104b4057e4c3f210cdb612b48491
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / rocketry-2.5.1-py3-none-any.whl

Download URL rocketry-2.5.1-py3-none-any.whl
Size 216.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8755e909026ba401174218bc0a0958044973244cd07e1405e80f85512440253
BLAKE2b-256 checksum
How to use checksums
237aafeff59c7c1e418633d96e854a1e5c3da9b49cc2ef952fb9bee335d9bed3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release history Release notifications | RSS feed

This release

2.5.1 This release

2 release files

2.5.0

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page