fix(py-parser): extract docstring Args descriptions for async def main

Closed
HS
4d ago
+51-9

Summary

strip_def in windmill-parser-py supports async def main(...) signatures, but extract_code_metadata dropped docstring Args: parameter descriptions for async def entrypoints in two places:

  1. filter_relevant_statements only retained lines starting with class or def , stripping async def blocks before AST parsing.
  2. extract_code_metadata matched StmtFunctionDef with is_async: false, skipping async entrypoint functions when extracting docstring Args: descriptions.

This change updates filter_relevant_statements to retain async def blocks and allows extract_code_metadata to read the docstring of main_name regardless of is_async.

Related to #2451

Test Plan

  • cargo test -p windmill-parser-py (added test_parse_python_sig_async_main_docstring_args covering async def main with Enum and scalar parameter docstring Args: descriptions; 37/37 passed)
  • cargo fmt --manifest-path backend/parsers/windmill-parser-py/Cargo.toml --check

Summary by cubic

Fixes the windmill-parser-py extractor so async def main entrypoints now get docstring Args: descriptions, matching the behavior of regular def main. Previously, async entrypoints lost parameter descriptions in two places: filter_relevant_statements stripped async def blocks before AST parsing, and extract_code_metadata only matched non-async function definitions.

Related to #2451.