{"id":7701,"library":"schedula","title":"Schedula","description":"Schedula is a dynamic flow-based programming environment for Python that automatically handles the control flow of programs. It produces a plan that dispatches calls based on a graph of functions, satisfying data dependencies. The library helps to define and execute dataflow execution models, extract sub-models, and can be used to deploy web API services. It is currently at version 1.6.15 and is actively maintained with regular updates.","status":"active","version":"1.6.15","language":"en","source_language":"en","source_url":"https://github.com/vinci1it2000/schedula","tags":["workflow","DAG","scheduling","dataflow","parallel","async","flow-based programming"],"install":[{"cmd":"pip install schedula","lang":"bash","label":"Install base package"},{"cmd":"pip install 'schedula[all]'","lang":"bash","label":"Install with all optional dependencies"}],"dependencies":[{"reason":"Required for cryptographic examples/use cases in documentation, typically installed separately if needed.","package":"cryptography","optional":true},{"reason":"Required system-wide (not just Python package) for the 'plot' extra to render workflow diagrams.","package":"Graphviz","optional":true}],"imports":[{"symbol":"Dispatcher","correct":"import schedula as sh\ndsp = sh.Dispatcher(...)"}],"quickstart":{"code":"import schedula as sh\n\n# 1. Define a Dispatcher, which is the main model for your dataflow\ndsp = sh.Dispatcher(name='my_simple_workflow')\n\n# 2. Define functions and add them to the Dispatcher using the decorator\n@sh.add_function(dsp, outputs=['y'])\ndef add_one(x):\n    print(f\"Executing add_one with x={x}\")\n    return x + 1\n\n@sh.add_function(dsp, outputs=['z'])\ndef multiply_by_two(y):\n    print(f\"Executing multiply_by_two with y={y}\")\n    return y * 2\n\n# 3. Dispatch the workflow with initial inputs and desired outputs\ninitial_inputs = {'x': 5}\ndesired_outputs = ['z']\n\ntry:\n    results = dsp.dispatch(inputs=initial_inputs, outputs=desired_outputs)\n    print(f\"\\nFinal result for 'z': {results['z']}\")\nexcept Exception as e:\n    print(f\"An error occurred during dispatch: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to define a simple dataflow model using `schedula.Dispatcher`, add functions with data dependencies using the `@sh.add_function` decorator, and then execute the workflow by calling `dispatch` with initial inputs and desired outputs. Schedula automatically determines the execution order based on data dependencies."},"warnings":[{"fix":"Review the documentation for required extras and install them, e.g., `pip install 'schedula[plot]'`.","message":"Many advanced functionalities (like plotting, web API generation, or specific parallel execution strategies) are provided via 'extras'. These must be explicitly installed using `pip install 'schedula[extra_name]'` or `pip install 'schedula[all]'`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install Graphviz from its official website (graphviz.org/download/) and ensure its `bin` directory is added to your system's PATH.","message":"The 'plot' extra, which enables visualizing your dataflow models, relies on the external Graphviz system library. Installing `schedula[plot]` only installs the Python bindings; Graphviz itself (and its `dot` executable) must be installed separately on your operating system and be accessible in your system's PATH.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Benchmark your specific use case to determine if concurrent execution provides a performance gain or if a synchronous execution model is more efficient for your workload.","message":"While `schedula` supports asynchronous and parallel dispatching, there is an inherent performance cost associated with creating and managing threads/processes. For very short-duration tasks, this overhead might negate the benefits of concurrency.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install schedula` in your terminal to install the package, or activate the correct virtual environment if you've already installed it.","cause":"The 'schedula' package has not been installed in your current Python environment or the environment where it was installed is not active.","error":"ModuleNotFoundError: No module named 'schedula'"},{"fix":"Install the library with the required extra. For example, to enable plotting, use `pip install 'schedula[plot]'`. For all extras, use `pip install 'schedula[all]'`.","cause":"You are attempting to use a feature that is part of an optional 'extra' (e.g., `plot`, `web`) without having installed `schedula` with that specific extra.","error":"AttributeError: 'Dispatcher' object has no attribute 'plot' (or 'web', 'to_server', etc.)"},{"fix":"Install the Graphviz system package (e.g., via your OS package manager or from graphviz.org/download/) and ensure its installation directory, containing `dot`, is added to your system's PATH environment variable.","cause":"The `plot` functionality in `schedula` relies on the Graphviz command-line tools, specifically the `dot` executable. This error indicates that `dot` is not found in your system's PATH.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'dot' (when using plot functionality)"}]}