Add Template & Renderer for Custom Deployment SDK (Phase 3)
This implements Phase 3 of the Custom Deployment SDK, adding the Jinja2
template and renderer that generates typed Python code from deployment data.
Key features:
- Jinja2 template that generates deployment classes with typed parameters
- run() and run_async() methods returning PrefectFlowRunFuture
- with_options() for run configuration (tags, idempotency_key, etc.)
- with_infra() for typed job variable overrides
- @overload decorators for type-safe from_name() dispatch
- TypedDict classes for work pool job variables
Implementation details:
- Template locals use _sdk_ prefix to avoid parameter name collisions
- Reserved names simplified to only 'self' for deployment context
- Work pools sorted by name for deterministic output
- Template loading via importlib.resources for robust package access
- cast() used to handle @async_dispatch union return type
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>