Hi! I think what you're looking for is the prodigy.serve
function: https://prodi.gy/docs/api-components#serve It looks like a command-line command for consistency, but it's not actually calling a command in a subprocess – it gets the wrapped recipe function, parses the arguments, calls the function, uses it to initialize the controller and then starts the Prodigy web server.
Here's how it looks under the hood:
from prodigy import get_recipe
from prodigy.app import server
import shlex
def serve(command, *recipe_args, **config):
cli_args = shlex.split(command)
recipe_name = cli_args.pop(0)
loaded_recipe = get_recipe(recipe_name)
controller = loaded_recipe(*cli_args, use_plac=True)
controller.config.update(config)
server(controller, controller.config)