Bigger Applications

When your project grows in size you might want to put the application to multiple files.

├── app
│   ├──
│   ├──
│   ├──
│   ├──
│   └── tasks
│       ├──
│       ├──
│       └──


We use files to make importing easier from the tasks. This structure enables us importing the conditions by from app.conditions import my_cond.


Here is a quick explanation of the files and what you could put in each:


Marks the directory as a package. You can leave these empty.


Entry point to the application. This

It could look like:

from rocketry import Rocketry
from app.tasks import morning, evening

app = Rocketry()

# Set Task Groups
# ---------------


# Application Setup
# -----------------

def set_repo(logger=TaskLogger()):
    repo = SQLRepo(engine=create_engine("sqlite:///app.db"), table="tasks", model=MinimalRecord, id_field="created")

def set_config(config=Config(), env=EnvArg("ENV", default="dev")):
    if env == "prod":
        config.silence_task_prerun = True
        config.silence_task_logging = True
        config.silence_cond_check = True
        config.silence_task_prerun = False
        config.silence_task_logging = False
        config.silence_cond_check = False

if __name__ == "__main__":

Read more from the app settings cookbook.


Put your custom conditions here.

For example:

from rocketry.conds import condition

def my_cond():
    return True or False

Put your custom parameters here. For example:

from rocketry.args import argument

def my_value():
    return "Hello"

You can also nest these and pass an argument as to another argument with FuncArg similarly we set in the task.


Put your tasks here. Use also groups and put the groups in the app in app/ to avoid problems in importing.

For example, app/tasks/ could look like this:

from rocketry import Grouper

from app.conditions import my_cond
from app.parameters import my_value

group = Grouper()

def do_things(arg=my_value):


There are various ways to set the tasks. You can use other patterns as well.


Then you can run this as a Python module:

python -m app.main

Or alternatively create a script that imports and launches the app:

from app.main import app


You can also turn this to a package using or add CLI by creating file.