Generate index page.
(classes: list[dict], decorators: list[dict])
| 478 | |
| 479 | |
| 480 | def generate_index_mdx(classes: list[dict], decorators: list[dict]) -> str: |
| 481 | """Generate index page.""" |
| 482 | |
| 483 | # Classes table |
| 484 | class_rows = [] |
| 485 | for c in classes: |
| 486 | link = f"/reference/sdk-reference/python/{slug_for(c['name'])}" |
| 487 | desc = ( |
| 488 | c["description"][:80] + "..." |
| 489 | if len(c["description"]) > 80 |
| 490 | else c["description"] |
| 491 | ) |
| 492 | class_rows.append(f"| [`{display_name_for(c['name'])}`]({link}) | {desc} |") |
| 493 | |
| 494 | # Decorators section |
| 495 | dec_section = "" |
| 496 | if decorators: |
| 497 | dec_lines = ["## Decorators", ""] |
| 498 | for d in decorators: |
| 499 | dec_lines.append(f"### {d['name']}") |
| 500 | dec_lines.append("") |
| 501 | if d["description"]: |
| 502 | dec_lines.append(d["description"]) |
| 503 | dec_lines.append("") |
| 504 | if d["source_link"]: |
| 505 | dec_lines.append(f"[View source]({d['source_link']})") |
| 506 | dec_lines.append("") |
| 507 | # Signature |
| 508 | params = ", ".join( |
| 509 | f"{p['name']}: {p['type']}" + (" = ..." if p["optional"] else "") |
| 510 | for p in d["parameters"] |
| 511 | ) |
| 512 | dec_lines.append("```python") |
| 513 | dec_lines.append(f"@{d['name']}({params})") |
| 514 | dec_lines.append("def my_modifier(...):") |
| 515 | dec_lines.append(" ...") |
| 516 | dec_lines.append("```") |
| 517 | dec_lines.append("") |
| 518 | dec_section = "\n".join(dec_lines) |
| 519 | |
| 520 | return f"""--- |
| 521 | title: {escape_yaml_string("Python SDK Reference")} |
| 522 | description: {escape_yaml_string("API reference for the Composio Python SDK")} |
| 523 | --- |
| 524 | |
| 525 | # Python SDK Reference |
| 526 | |
| 527 | Complete API reference for the `composio` Python package. |
| 528 | |
| 529 | ## Installation |
| 530 | |
| 531 | ```bash |
| 532 | pip install composio |
| 533 | ``` |
| 534 | |
| 535 | Or with uv: |
| 536 | |
| 537 | ```bash |
no test coverage detected
searching dependent graphs…