Commits
Click on a commit to change the comparison rangeAdd Phase 2 of Custom Deployment SDK: Naming & Data Models
This phase adds:
1. Naming utilities (src/prefect/_sdk/naming.py):
- to_identifier(): Convert arbitrary names to valid Python identifiers
- to_class_name(): Convert names to PascalCase class names
- Unicode separator handling (em-dash, non-breaking space become word boundaries)
- NFKD normalization for accented characters (é → e)
- Python keyword handling (class → class_ for identifiers, Class for class names)
- Reserved name detection for SDK surface (run, run_async, with_options, etc.)
- Collision resolution with numeric suffixes (_2, _3, etc.)
2. Data models (src/prefect/_sdk/models.py):
- WorkPoolInfo: Work pool name, type, job variables schema
- DeploymentInfo: Deployment name, flow name, parameter schema, work pool ref
- FlowInfo: Flow name with list of deployments
- SDKGenerationMetadata: Generation time, Prefect version, workspace, API URL
- SDKData: Complete container for SDK generation with convenience methods
3. Comprehensive tests (227 total for _sdk module):
- Edge cases: emoji, Unicode, keywords, empty strings, collisions
- Non-ASCII separators, German ß, Unicode digits
- Deterministic ordering verification
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>