Skip to content

Add documentation for prefect sdk generate CLI#1

Open
tomerqodo wants to merge 8 commits intocoderabbit_full_base_add_documentation_for_prefect_sdk_generate_cli_pr1from
coderabbit_full_head_add_documentation_for_prefect_sdk_generate_cli_pr1
Open

Add documentation for prefect sdk generate CLI#1
tomerqodo wants to merge 8 commits intocoderabbit_full_base_add_documentation_for_prefect_sdk_generate_cli_pr1from
coderabbit_full_head_add_documentation_for_prefect_sdk_generate_cli_pr1

Conversation

@tomerqodo
Copy link
Copy Markdown

@tomerqodo tomerqodo commented Jan 30, 2026

Benchmark PR from agentic-review-benchmarks#1

Summary by CodeRabbit

  • New Features

    • Introduced prefect sdk generate command to create typed Python SDKs from workspace deployments with filtering by flow and deployment names.
  • Documentation

    • Added new documentation pages explaining custom Python SDK generation, prerequisites, and comprehensive usage examples.
    • Reorganized documentation structure with new Deployments section for advanced topics.

desertaxle and others added 8 commits January 25, 2026 12:09
- Add auto-generated CLI reference for `prefect sdk` command
- Add how-to guide for generating typed SDKs from deployments
- Update navigation in docs.json for both new pages
- Regenerate CLI docs to include new --output options

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Keep only sdk.mdx from the CLI docs regeneration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The code examples reference a hypothetical my_sdk module that
doesn't exist, so they can't be executed as tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove marketing-style "before/after" section
- Use sentence case headers
- Task-oriented organization (CLI then Python)
- Add opening context and further reading links
- Direct, instructional tone throughout

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove marketing-style "before/after" section
- Use sentence case headers
- Task-oriented organization (CLI then Python)
- Add opening context and further reading links
- Direct, instructional tone throughout

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move generate-custom-sdk.mdx to docs/v3/advanced/
- Create new "Deployments" group in Advanced section
- Move form-building guide to new Deployments group
- Both guides relate to deployment configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

New documentation pages describe custom Python SDK generation functionality for Prefect deployments via CLI. Documentation structure reorganized to include SDK references. Core SDK fetcher implementation refined with logging, simplified extraction logic, relaxed iteration constraints, and adjusted deployment filtering to support both short and full names.

Changes

Cohort / File(s) Summary
Documentation Structure
docs/docs.json
Reorganized documentation hierarchy: moved form-building to new Deployments group and added CLI SDK reference entry.
CLI SDK Documentation
docs/v3/api-ref/cli/sdk.mdx
New documentation page detailing the prefect sdk generate CLI command with beta status, usage examples, and options for filtering deployments and flows with prerequisites.
SDK Generation Guide
docs/v3/advanced/generate-custom-sdk.mdx
New comprehensive guide covering custom Python SDK generation for deployments, including prerequisites, multiple filtering scenarios, deployment execution patterns, method chaining, and regeneration guidelines.
SDK Fetcher Implementation
src/prefect/_sdk/fetcher.py
Added module-level logging for authentication checks; simplified job variables schema extraction; relaxed strict iteration in parallel pool fetching; adjusted deployment filtering logic to support both short and full-name matching while maintaining ambiguity tracking.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hoppy news from burrows deep,
New SDKs for devs to keep!
Deployments dance with custom grace,
While loggers trace each CLI space,
Documentation blooms so bright,
Our SDK fetcher shines its light!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete and does not follow the provided template. It only provides a benchmark reference without addressing the required checklist items or detailed change overview. Provide a detailed overview of the proposed changes, complete the checklist by verifying unit tests are included, confirm if any redirect settings are needed, and ensure all required items are addressed.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: adding documentation for the prefect sdk generate CLI command across multiple documentation files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch coderabbit_full_head_add_documentation_for_prefect_sdk_generate_cli_pr1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tomerqodo
Copy link
Copy Markdown
Author

@coderabbitai review

1 similar comment
@tomerqodo
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tomerqodo
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bar-qodo
Copy link
Copy Markdown

bar-qodo commented Feb 2, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 2, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/prefect/_sdk/fetcher.py (1)

396-421: ⚠️ Potential issue | 🟡 Minor

Short-name ambiguity warnings can be skipped for direct matches.
When dep.name is in deployment_names, the block is bypassed and short_name_matches isn’t populated, so ambiguity warnings won’t fire for short-name filters. Consider tracking short-name matches even when the name is directly listed.

🔧 Suggested adjustment
-        if deployment_names and dep.name not in deployment_names:
+        if deployment_names:
             # Only include if the full name matches (filter was by name parts)
             # Skip if user specified full names and this doesn't match
             found_match = False
             matched_short_name: str | None = None
-            for dn in deployment_names:
-                if "/" not in dn:
-                    # User gave just deployment name, check against dep.name
-                    if dep.name == dn:
-                        found_match = True
-                        matched_short_name = dn
-                        break
-                else:
-                    # User gave full name, must match exactly
-                    if full_name == dn:
-                        found_match = True
-                        break
+            if dep.name in deployment_names:
+                found_match = True
+                matched_short_name = dep.name
+            else:
+                for dn in deployment_names:
+                    if "/" not in dn:
+                        # User gave just deployment name, check against dep.name
+                        if dep.name == dn:
+                            found_match = True
+                            matched_short_name = dn
+                            break
+                    else:
+                        # User gave full name, must match exactly
+                        if full_name == dn:
+                            found_match = True
+                            break
             if not found_match:
                 continue
             # Track short name matches for ambiguity warning
             if matched_short_name:
                 if matched_short_name not in short_name_matches:
                     short_name_matches[matched_short_name] = []
                 short_name_matches[matched_short_name].append(full_name)
🤖 Fix all issues with AI agents
In `@docs/v3/api-ref/cli/sdk.mdx`:
- Around line 37-45: Remove the stray control character line inside the Info
block in the docs/v3/api-ref/cli/sdk.mdx file — locate the "Info" block
containing "(beta) Generate a typed Python SDK..." and delete the lone
control-character-only line between the PREFECT_API_URL sentence and the
"Examples:" heading so the Info block contains only valid text lines.

In `@src/prefect/_sdk/fetcher.py`:
- Around line 219-221: The zip over pool_names_list and results should use
strict=True to satisfy Ruff B905 and ensure lengths match; update the zip(...)
call where pool_names_list and results are iterated (the loop that populates
work_pools) to zip(pool_names_list, results, strict=True) so mismatched lengths
raise immediately—modify the for loop that currently reads for name, result in
zip(pool_names_list, results): to include the strict parameter.

Comment on lines +37 to +45
<Info>
(beta) Generate a typed Python SDK from workspace deployments.

The generated SDK provides IDE autocomplete and type checking for your deployments.
Requires an active Prefect API connection (use `prefect cloud login` or configure
PREFECT_API_URL).


Examples:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove the stray control character in the Info block.
The lone control character line can render as a broken glyph or fail linting; please delete it.

🔧 Proposed removal
-
🤖 Prompt for AI Agents
In `@docs/v3/api-ref/cli/sdk.mdx` around lines 37 - 45, Remove the stray control
character line inside the Info block in the docs/v3/api-ref/cli/sdk.mdx file —
locate the "Info" block containing "(beta) Generate a typed Python SDK..." and
delete the lone control-character-only line between the PREFECT_API_URL sentence
and the "Examples:" heading so the Info block contains only valid text lines.

Comment on lines 219 to 221
work_pools: dict[str, WorkPoolInfo] = {}
for name, result in zip(pool_names_list, results, strict=True):
for name, result in zip(pool_names_list, results):
if isinstance(result, BaseException):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check Python version requirements and Ruff configuration
rg -n --no-heading "requires-python|python_requires|target-version|tool\.ruff|B905" pyproject.toml setup.cfg setup.py 2>/dev/null

Repository: agentic-review-benchmarks/prefect-combined-coderabbit

Length of output: 309


🏁 Script executed:

#!/bin/bash
# Read the Ruff configuration section from pyproject.toml
sed -n '314,335p' pyproject.toml

Repository: agentic-review-benchmarks/prefect-combined-coderabbit

Length of output: 570


🏁 Script executed:

#!/bin/bash
# Read the code context around lines 219-221
sed -n '210,230p' src/prefect/_sdk/fetcher.py

Repository: agentic-review-benchmarks/prefect-combined-coderabbit

Length of output: 953


Add strict=True to the zip() call to resolve Ruff B905.

Since the project requires Python ≥3.10, the strict parameter is available. Both pool_names_list and results are guaranteed to have equal lengths (created from the same source list via list comprehension and asyncio.gather()), so strict=True is semantically correct:

🔧 Fix
-    for name, result in zip(pool_names_list, results):
+    for name, result in zip(pool_names_list, results, strict=True):
🧰 Tools
🪛 Ruff (0.14.14)

[warning] 220-220: zip() without an explicit strict= parameter

Add explicit value for parameter strict=

(B905)

🤖 Prompt for AI Agents
In `@src/prefect/_sdk/fetcher.py` around lines 219 - 221, The zip over
pool_names_list and results should use strict=True to satisfy Ruff B905 and
ensure lengths match; update the zip(...) call where pool_names_list and results
are iterated (the loop that populates work_pools) to zip(pool_names_list,
results, strict=True) so mismatched lengths raise immediately—modify the for
loop that currently reads for name, result in zip(pool_names_list, results): to
include the strict parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants