{"id":6646,"library":"flytekit","title":"Flytekit","description":"Flytekit is the Python SDK for Flyte, an open-source platform for building highly scalable, reliable, and reproducible data and ML workflows. It allows developers to author tasks, workflows, and launch plans using familiar Pythonic constructs like functions and decorators. Currently at version 1.16.19, Flytekit maintains a rapid release cadence with multiple minor updates typically published each month.","status":"active","version":"1.16.19","language":"en","source_language":"en","source_url":"https://github.com/flyteorg/flytekit","tags":["orchestration","workflow","mlops","data science","pipeline","task"],"install":[{"cmd":"pip install flytekit","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Python 3.10, 3.11, or 3.12 for current versions.","package":"python","optional":false},{"reason":"Optional plugins for integrations with various systems (e.g., Spark, Pandas, MLflow, Great Expectations, AWS, GCP, etc.) and enhanced UI rendering capabilities (e.g., flytekitplugins-deck-standard).","package":"flytekitplugins-*","optional":true}],"imports":[{"symbol":"task","correct":"from flytekit import task"},{"symbol":"workflow","correct":"from flytekit import workflow"},{"note":"Used to access execution context like current project, domain, or workflow ID.","symbol":"current_context","correct":"from flytekit import current_context"}],"quickstart":{"code":"from flytekit import task, workflow\n\n@task\ndef say_hello(name: str) -> str:\n    return f\"Hello, {name}!\"\n\n@workflow\ndef hello_world_wf(name: str = \"world\") -> str:\n    res = say_hello(name=name)\n    return res\n\nif __name__ == \"__main__\":\n    # Run locally\n    print(f\"Local execution: {hello_world_wf(name='Flyte')}\")\n    # Alternatively, use pyflyte CLI for local or remote execution:\n    # pyflyte run your_script.py hello_world_wf --name Flyte","lang":"python","description":"This quickstart defines a simple Flyte task `say_hello` and a workflow `hello_world_wf` that orchestrates it. Tasks are Python functions decorated with `@task`, and workflows are Python functions decorated with `@workflow`. All inputs and outputs must be type-annotated. The workflow can be run locally like a regular Python function or via the `pyflyte` CLI."},"warnings":[{"fix":"Upgrade both your `flytekit` SDK and your Flyte backend deployment to version 1.14 or higher. For temporary backward compatibility, you can set the `FLYTE_USE_OLD_DC_FORMAT` environment variable to `true`.","message":"Flytekit v1.14.0 introduced a change to use MessagePack for serializing Python `dict`, `dataclass`, and `Pydantic BaseModel` types instead of JSON strings within a Protobuf struct. This change is not fully backward-compatible with Flyte backend versions older than 1.14. If referencing tasks registered with `flytekit>=1.14` from downstream tasks using `flytekit<1.14`, you may encounter `TypeTransformerFailedError`.","severity":"breaking","affected_versions":">=1.14.0"},{"fix":"This issue is likely due to changes in how tasks and workflows are referenced and registered in newer versions. Consult the official Flytekit documentation and migration guides for your specific version to understand new registration patterns or configuration requirements. Ensure your Flyte backend is also compatible with your `flytekit` version.","message":"When upgrading to `flytekit>=1.13.0`, users have reported `TaskReferenceNotFound` errors during workflow compilation and registration, especially when registering scripts to a Flyte cluster. Older versions (e.g., `flytekit==1.11.0`) might not exhibit this behavior.","severity":"breaking","affected_versions":">=1.13.0"},{"fix":"Always provide explicit and correct type hints for all function arguments and return values in `@task` and `@workflow` decorated functions. Use Python's `typing` module for complex types. Refer to Flytekit's type system documentation for supported types and best practices.","message":"Flytekit strictly enforces type hints for all task inputs and outputs. If type annotations are incorrect or missing (and cannot be inferred), Flytekit will raise a compilation error during registration, preventing the workflow from running. This is a design choice to ensure robust and predictable workflows.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Understand that `workflow` definitions are primarily for orchestration. Avoid placing complex computational logic directly within a workflow body that is intended to run at execution time. Instead, encapsulate such logic within tasks.","message":"The body of a `@workflow` decorated function in Flytekit executes at *registration time* to construct the Directed Acyclic Graph (DAG) of tasks, not at runtime for actual computation. The actual computation logic is encapsulated within individual `@task` decorated functions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your development and execution environments use Python 3.10, 3.11, or 3.12. If you are on an older Python version, consider upgrading or using an older, compatible `flytekit` release at your own risk.","message":"Flytekit's current stable versions (1.16.x) explicitly support Python versions 3.10, 3.11, and 3.12. Older Python versions, such as 3.8 or 3.9, may not be fully supported or tested, and could lead to unexpected behavior or installation issues.","severity":"gotcha","affected_versions":">=1.16.x (and specifically from 1.16.13 onwards)"},{"fix":"If you require individual subtasks to complete even if others fail, you may need to explicitly configure the dynamic task with parameters that control this failure tolerance (e.g., a ratio of acceptable successful tasks, if supported by the specific dynamic task implementation).","message":"In dynamic workflows, if one subtask fails, the default behavior is for all other running subtasks within that dynamic workflow to also fail. This is designed to conserve resources, assuming downstream tasks depend on all upstream outputs.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}